twitter-stream-channels

API Docs for: 1.0.0
Show:

TwitterStreamChannelsMock

Summary

This class mocks TwitterStreamChannels so that you could work offline, on your own data, without connecting to Twitter.

See the examples on the github repo

Constructor

TwitterStreamChannelsMock

Syntax

TwitterStreamChannelsMock

(
  • [options]
)
TwitterStreamChannelsMock

Summary

Parameters:

  • [options] Object optional

    @optional (since it's a mock, no credentials needed

    • [tweets] File optional

      @optional (by default will load /mocks/data/tweets.json)

    • [singleRun=true] Boolean optional

      @optional if false will loop on the tweets mock array until you call stop (default true)

    • [tweetDelay=100] Number optional

      @optional delay between each tweets emitted in ms (default 100ms)

Item Index

Methods

getApiClient

Syntax

getApiClient

() TwitMock

Summary

Returns a mocked version of apiClient, only the .stream() method is mocked (will stream exactly the same tweets as stream.streamChannels())

Returns:

TwitMock:

streamChannels

Syntax

streamChannels

(
  • options
)
StreamChannels

Summary

Mocks the TwitterStreamChannels.streamChannels(options) method of TwitterStreamChannels to return a StreamChannels object

Will start to emit the tweets you specified in the tweets attributes in the constructor.

Parameters:

  • options Object
    • track Object | Array

      Pass an object describing your channels. If you don't want to use channels, you can pass directly an array of keywords.

    • [enableChannelsEvents=true] Boolean optional

      If true, will fire the events like 'channels/channelName'

    • [enableRootChannelsEvent=true] Boolean optional

      If true, will fire the event 'channels'

    • [enableKeywordsEvents=false] Boolean optional

      If true, will fire the events 'keywords/keywordName' (disabled by default)

Returns: