twitter/twitter.js
function TwitterAPIConnection(n) {
        RED.nodes.createNode(this,n);
        var node = this;
        node.consumerKey = n.consumerKey;
        node.consumerSecret = n.consumerSecret;
        node.accessToken = n.accessToken;
        node.accessSecret = n.accessSecret;

        var id = node.consumerKey;

        node.log('create new Twitter instance for: ' + id);
        
        clients[id] = new Twit({
            consumer_key: node.consumerKey,
            consumer_secret: node.consumerSecret,
            access_token: node.accessToken,
            access_token_secret: node.accessSecret
        });
        
        node.client = clients[id];

        this.on("close", function() {
            node.log('delete Twitter instance on close event');
            delete clients[id];
        });
    }
function TwitterAPIConnection(n) {
        RED.nodes.createNode(this,n);
        var node = this;
        node.consumerKey = n.consumerKey;
        node.consumerSecret = n.consumerSecret;
        node.accessToken = n.accessToken;
        node.accessSecret = n.accessSecret;

        var id = node.consumerKey;

        node.log('create new Twitter instance for: ' + id);
        
        clients[id] = new Twit({
            consumer_key: node.consumerKey,
            consumer_secret: node.consumerSecret,
            access_token: node.accessToken,
            access_token_secret: node.accessSecret
        });
        
        node.client = clients[id];

        this.on("close", function() {
            node.log('delete Twitter instance on close event');
            delete clients[id];
        });
    }
function TwitterAPIConnection ( n ) { RED . nodes . createNode ( this , n ) ; var node = this ; node . consumerKey = n . consumerKey ; node . consumerSecret = n . consumerSecret ; node . accessToken = n . accessToken ; node . accessSecret = n . accessSecret ; var id = node . consumerKey ; node . log ( 'create new Twitter instance for: ' + id ) ; clients [ id ] = new Twit ( { consumer_key : node . consumerKey , consumer_secret : node . consumerSecret , access_token : node . accessToken , access_token_secret : node . accessSecret } ) ; node . client = clients [ id ] ; this . on ( "close" , function ( ) { node . log ( 'delete Twitter instance on close event' ) ; delete clients [ id ] ; } ) ; }
handle the connection to the Twitter API
handle the connection to the Twitter API