Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm's 300,000 packages pre-installed, including tweet-collector-supervisor with all npm packages installed. Try it out:

var tweetCollectorSupervisor = require("tweet-collector-supervisor")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

tweet-collector-supervisor v1.0.1

Tweet Collector Supervisor

Easier handler for multiple Tweet Collector instances.

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.

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free