Twitter Singleton

This is a layer that will handle communication with Twitter and secures the connection outside the Application.
If the user has not yet done the authentication process this will start and handle the process automatically.

Twitter()

Example

Twitter.api('statuses/user_timeline', { count: 30 }, function(result) {
   //Received a response from Twitter API.
   console.log('The result:', result);
});

Methods

api(path, method, params, callback)

This method will make calls to the Twitter API's. Look at the twitter API for what is possible.

Parameters:

Name Type Argument Description
path String

The API call path as defined by Twitter.

method String optional 

The HTTP method that you want to use for the API request. Default is get

params Object

The parameter object to include in the API call.

callback function

The method that will be triggered when the API call returns a result.

reset()

This will reset the Twitter API. Subscribed function will also be removed.

Events

onConnected

The active profile has a twitter authentication and the user has connected by entering a password.

onDisconnected

The active profile lost the connection with twitter.

onUnpairedProfile

The active profile has no twitter authentication done.