I don't mind trading my opinion for a better one,
but not for one with equal or lesser value.
- My father

Potential.js

  • Lobby
  • Pubnub
  • PubnubAdapter
  • WebsyncAdapter

Meet Mr. Lobby


Meet Mr. Pubnub


UTILITIES


NEXTORIGIN ========== var next_origin = nextorigin();


Build Url =======


UPDATER ======= var timestamp = unique();


GREP ==== var list = grep( [1,2,3], function(item) { return item % 2 } )


SUPPLANT ======== var text = supplant( 'Hello {name}!', { name : 'John' } )


timeout ======= timeout ( function(){}, 100 );


uuid ==== var my_uuid = uuid();


EACH ==== each ( [1,2,3], function(item) { } )


MAP === var list = map( [1,2,3], function(item) { return item + 1 } )


ENCODE ====== var encoded_path = encode('path');


Generate Subscription Channel List ================================== generate_channel_list (channels_object);


UTIL LOCALS


CONSOLE COMPATIBILITY


LOCAL STORAGE OR COOKIE


$ = var div = $('divid');


ERROR ===== error ('message');


SEARCH ====== var elements = search('a div span');


BIND ==== bind ( 'keydown', search('a')[0], function(element) { ... } );


UNBIND ====== unbind ( 'keydown', search('a')[0] );


HEAD ==== head ().appendChild(elm);


ATTR ==== var attribute = attr( node, 'attribute' );


CSS === var obj = create('div');


CREATE ====== var obj = create('div');


jsonp_cb ======== var callback = jsonp_cb();


EVENTS ====== PUBNUB.events.bind ( 'you-stepped-on-flower', function(message) { // Do Stuff with message } ); PUBNUB.events.fire ( 'you-stepped-on-flower', "message-data" ); PUBNUB.events.fire ( 'you-stepped-on-flower', {message:"data"} ); PUBNUB.events.fire ( 'you-stepped-on-flower', [1,2,3] );


XDR Cross Domain Request ======================== xdr ({ url : ['http://www.blah.com/url'], success : function(response) {}, fail : function() {} });


CORS XHR Request ================ xdr ({ url : ['http://www.blah.com/url'], success : function(response) {}, fail : function() {} });


Meet Mr. PubnubAdapter


Meet Mr. WebsyncAdapter