Easier handler for multiple Tweet Collector instances.
JavaScript
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib
test
.gitignore
README.md
package.json

README.md

Tweet Collector Supervisor

Easier handler for multiple Tweet Collector instances. See tweet-collector package.

var Supervisor = require('tweet-collector-supervisor');
var supervisor = new Supervisor();

var TweetCollector = require('tweet-collector');
var collectorOne = new TweetCollector({ ... });
var collectorTwo = new TweetCollector({ ... });
var collectorThree = new TweetCollector({ ... });

supervisor.addCollector(collectorOne, 0);
supervisor.addCollector(collectorTwo, 'one');
supervisor.addCollector(collectorThree, 2);

supervisor.start();
supervisor.on('fetch', function onFetch(collectorId, tweets) {
  console.log(collectorId);
  console.log(tweets);
});
supervisor.stop();

API

supervisor.addCollector(tweetCollector, collectorId)

Supervise a collector.

  • tweetCollector: an instance of TweetCollector
  • collectorId: collector identification; you can keep track from which collector tweets were fetched

supervisor.start()

Starts collectors.

supervisor.stop()

Stops collectors.