npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

twittercordovaplugin

v0.0.3

Published

An Apache Cordova plugin for the Twitter Streaming API. Currently only works for Android.

Downloads

8

Readme

Twitter Streaming Cordova Plugin

This is a quick Apache Cordova plugin to use the Twitter Streaming APIs within a hybrid mobile application. It uses the twitter4J Java code

Dependencies

  • org.apache.cordova.inappbrowser http://plugins.cordova.io/#/package/org.apache.cordova.inappbrowser
  • jsOAuth
  • Twitter4J

Dependencies are installed automatically. There are no configuration steps that are required by the user.

#Supported Platforms

  • Android

This Cordova plugin only works for Android at this time

#Installing Install with Cordova CLI

$ cd /path/to/your/project $ cordova plugin add com.lisaseacat.twitter

API

Methods

init

Intialize the metawear device.

twitter.init(successCallback, failureCallback, oauthconsumerkey, oauthconsumersecret, callbackURL);

Description

Function 'init' initializes the twitter streaming service. This method attempts to connect to twitter. It uses the inappbrowser plugin to ask the user to authorize the app to use Twitter. On successful authorization it will automatically start listening for tweets with a specific hashtag. The success callback is called when a new tweet is found matching the keyword. To set the keyword use the sethashtag method. You will need to setup a Twitter app at https://apps.twitter.com/.

Parameters

  • successCallback: Success callback function that is invoked when twitter is authorized by the user through oAuth and a message is received.
  • failureCallback: Error callback function, invoked when error occurs.
  • oauthconsumerkey: The oauth consumer key that was setup in the Twitter API developer console.
  • oauthconsumersecret: The oauth consumer secret that was setup in the Twitter API developer console.
  • callbackURL: The oauth callback URL that was setup in the Twitter API developer console. It doesn't matter what this value is. It's not used in Cordova, but necessary for OAuth to work.
  • keyword: The keyword to listen for. You can change the keyword at any time by calling addHashtag. [optional]

stopTwitterStream

twitter.stopTwitterStream(successCallback, failureCallback) 

Description

Function 'stopTwitterStream' tells the twitter stream to stop listening. To start it back up after it has been stopped you'll have to call init again.

Parameters

  • successCallback: Success callback function that is invoked when the twitter stream was successfully stopped.
  • failureCallback: Error callback function, invoked when error occurs.

addHashtag

twitter.addHashtag(successCallback, failureCallback, keyword, reset) 

Description

Function 'setHashTag' tells the twitter stream which keyword to listen for.

Parameters

  • successCallback: Success callback function that is invoked when the twitter stream was successfully stopped.
  • failureCallback: Error callback function, invoked when error occurs.
  • keyword: The keyword to listen for. You can change the keyword at any time by calling this method again.
  • reset: boolean. By setting to true, the old hashtag value will be cleared out. If set to false, the streaming search will look for ALL of the previous keywords as well as the new keyword. Default value is false. [optional]

getHashtag_NoStream

twitter.getHashtag_NoStream(successCallback, failureCallback) 

Description

Function 'getHashtag_NoStream' lets you retrieve hashtags from Twitter without using the streaming service. There is a rate limit set by Twitter to use this method..

Parameters

  • successCallback: Success callback function that is invoked when the response is received. Unlike the streaming service you will have to call this method multiple times each time you wish to receive the information.
  • failureCallback: Error callback function, invoked when error occurs.

getHomeTimeline_NoStream

twitter.getHomeTimeline_NoStream(successCallback, failureCallback) 

Description

Function 'getHomeTimeline_NoStream' lets you retrieve the home timeline from Twitter without using the streaming service. There is a rate limit set by Twitter to use this method..

Parameters

  • successCallback: Success callback function that is invoked when the response is received. Unlike the streaming service you will have to call this method multiple times each time you wish to receive the information.
  • failureCallback: Error callback function, invoked when error occurs.

getMentions_NoStream

twitter.getMentions_NoStream(successCallback, failureCallback) 

Description

Function 'getMentions_NoStream' lets you retrieve hashtags from Twitter without using the streaming service. There is a rate limit set by Twitter to use this method..

Parameters

  • successCallback: Success callback function that is invoked when the response is received. Unlike the streaming service you will have to call this method multiple times each time you wish to receive the information.
  • failureCallback: Error callback function, invoked when error occurs.

Quick Example

var streamtweet = {
    consumerKey: '__replaceMe__',
    consumerSecret: '__replaceMe__',
    callbackUrl: '__replaceMe__',
    start: function() {
        console.log('streamtweet start! ');
        twitter.init(streamtweet.tweetreceived, streamtweet.tweetfailed, streamtweet.consumerKey,streamtweet.consumerSecret,streamtweet.callbackUrl, 'LisaSeacat');
    }, 
    tweetreceived: function(data){
        console.log('SUCCESSFULLY got some streaming tweets: ' + JSON.stringify(data)); 
    }, tweetfailed: function(data){
        console.log('FAILED to get the tweets: ' + JSON.stringify(data));  
    }, tweetStopWin: function(data){
        console.log('SUCCESSFULLY stopped getting tweets: ' + JSON.stringify(data));  
    }, tweetStopFail: function(data){
        console.log('FAILED to stop the tweet stream: ' + JSON.stringify(data));  
    }, stop: function(){
        twitter.stopTwitterStream(streamtweet.tweetStopWin, streamtweet.tweetStopFail);   
    }
};