Skip to content

Commit

Permalink
v.1.0.1
Browse files Browse the repository at this point in the history
* better minification
  • Loading branch information
Nikos M committed May 13, 2016
1 parent 04f24cd commit 667e834
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 51 deletions.
32 changes: 16 additions & 16 deletions src/RT.BOSH.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ else
"use strict";

var PROTO = 'prototype', HAS = 'hasOwnProperty', toString = Object[PROTO].toString,
__super__ = RT.Client[PROTO], U = RT.Util, XHR = RT.XHR
RT_Client = RT.Client, __super__ = RT_Client[PROTO], U = RT.Util, RT_XHR = RT.XHR
;

RT.Client.BOSH = function Client_Bosh( cfg ) {
var Client_Bosh = RT_Client.BOSH = function Client_Bosh( cfg ) {
var self = this;
if ( !(self instanceof Client_Bosh) ) return new Client_Bosh(cfg);
__super__.constructor.call( self, cfg );
Expand All @@ -32,30 +32,30 @@ RT.Client.BOSH = function Client_Bosh( cfg ) {
self.$queue$ = [];
self.$mID$ = 0;
};
RT.Client.Impl['bosh'] = RT.Client.Impl['long-poll'] = RT.Client.BOSH;
RT_Client.Impl['bosh'] = RT_Client.Impl['long-poll'] = Client_Bosh;

/* extends RT.Client class */
RT.Client.BOSH[PROTO] = Object.create( __super__ );
RT.Client.BOSH[PROTO].constructor = RT.Client.BOSH;
RT.Client.BOSH[PROTO].$send$ = null;
RT.Client.BOSH[PROTO].$recv$ = null;
RT.Client.BOSH[PROTO].$queue$ = null;
RT.Client.BOSH[PROTO].$mID$ = null;
RT.Client.BOSH[PROTO].dispose = function( ){
Client_Bosh[PROTO] = Object.create( __super__ );
Client_Bosh[PROTO].constructor = Client_Bosh;
Client_Bosh[PROTO].$send$ = null;
Client_Bosh[PROTO].$recv$ = null;
Client_Bosh[PROTO].$queue$ = null;
Client_Bosh[PROTO].$mID$ = null;
Client_Bosh[PROTO].dispose = function( ){
var self = this;
if ( self.$recv$ ) { self.$recv$.abort( ).dispose( ); self.$recv$ = null; }
if ( self.$send$ ) { self.$send$.abort( ).dispose( ); self.$send$ = null; }
self.$queue$ = null;
self.$mID$ = null;
return __super__.dispose.call( self );
};
RT.Client.BOSH[PROTO].abort = function( trigger ){
Client_Bosh[PROTO].abort = function( trigger ){
var self = this;
if ( self.$recv$ ) { self.$recv$.abort( ).dispose( ); self.$recv$ = null; }
if ( self.$send$ ) { self.$send$.abort( ).dispose( ); self.$send$ = null; }
return __super__.abort.call( self, true===trigger );
};
RT.Client.BOSH[PROTO].send = function( payload ){
Client_Bosh[PROTO].send = function( payload ){
var self = this;
var send = function send( ) {
var asUrlEncoded = 'urlencoded' === self.$cfg$.contentType, asXML = 'xml' === self.$cfg$.contentType,
Expand Down Expand Up @@ -89,7 +89,7 @@ RT.Client.BOSH[PROTO].send = function( payload ){
headers['X-RT--Message'] = rt_msg = RT.UUID('------_rt_msg_', '_------');
rt_payload = rt_msgs.join( rt_msg );
}
self.$send$ = XHR.create({
self.$send$ = RT_XHR.create({
url : self.$cfg$.endpoint + (-1 < self.$cfg$.endpoint.indexOf('?') ? '&' : '?') + '__nocache__='+(new Date().getTime()),
timeout : self.$cfg$.timeout,
method : 'POST',
Expand Down Expand Up @@ -152,7 +152,7 @@ RT.Client.BOSH[PROTO].send = function( payload ){
if ( !self.$send$ ) setTimeout( send, 0 );
return self;
};
RT.Client.BOSH[PROTO].$receive$ = function( ){
Client_Bosh[PROTO].$receive$ = function( ){
var self = this;
if ( self.$recv$ ) return;
var asUrlEncoded = 'urlencoded' === self.$cfg$.contentType, asXML = 'xml' === self.$cfg$.contentType,
Expand All @@ -166,7 +166,7 @@ RT.Client.BOSH[PROTO].$receive$ = function( ){
'X-RT--mID' : self.$mID$
}
;
self.$recv$ = XHR.create({
self.$recv$ = RT_XHR.create({
url : self.$cfg$.endpoint + (-1 < self.$cfg$.endpoint.indexOf('?') ? '&' : '?') + '__nocache__='+(new Date().getTime()),
timeout : self.$cfg$.timeout,
method : 'POST',
Expand Down Expand Up @@ -240,7 +240,7 @@ RT.Client.BOSH[PROTO].$receive$ = function( ){
}
}, null);
};
RT.Client.BOSH[PROTO].listen = function( ){
Client_Bosh[PROTO].listen = function( ){
var self = this;
setTimeout( function( ){ self.$receive$( ); }, 10 );
return self.open( );
Expand Down
2 changes: 1 addition & 1 deletion src/RT.BOSH.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 14 additions & 14 deletions src/RT.Poll.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ else
"use strict";

var PROTO = 'prototype', HAS = 'hasOwnProperty', toString = Object[PROTO].toString,
__super__ = RT.Client[PROTO], U = RT.Util, XHR = RT.XHR
RT_Client = RT.Client, __super__ = RT_Client[PROTO], U = RT.Util, RT_XHR = RT.XHR
;

RT.Client.Poll = function Client_Poll( cfg ) {
var Client_Poll = RT_Client.Poll = function Client_Poll( cfg ) {
var self = this;
if ( !(self instanceof Client_Poll) ) return new Client_Poll(cfg);
__super__.constructor.call( self, cfg );
Expand All @@ -32,35 +32,35 @@ RT.Client.Poll = function Client_Poll( cfg ) {
self.$mID$ = 0;
self.$queue$ = [];
};
RT.Client.Impl['poll'] = RT.Client.Impl['short-poll'] = RT.Client.Poll;
RT_Client.Impl['poll'] = RT_Client.Impl['short-poll'] = Client_Poll;

/* extends RT.Client class */
RT.Client.Poll[PROTO] = Object.create( __super__ );
RT.Client.Poll[PROTO].constructor = RT.Client.Poll;
RT.Client.Poll[PROTO].$timer$ = null;
RT.Client.Poll[PROTO].$xhr$ = null;
RT.Client.Poll[PROTO].$queue$ = null;
RT.Client.Poll[PROTO].$mID$ = null;
RT.Client.Poll[PROTO].dispose = function( ){
Client_Poll[PROTO] = Object.create( __super__ );
Client_Poll[PROTO].constructor = Client_Poll;
Client_Poll[PROTO].$timer$ = null;
Client_Poll[PROTO].$xhr$ = null;
Client_Poll[PROTO].$queue$ = null;
Client_Poll[PROTO].$mID$ = null;
Client_Poll[PROTO].dispose = function( ){
var self = this;
if ( self.$timer$ ) { clearTimeout( self.$timer$ ); self.$timer$ = null; }
if ( self.$xhr$ ) { self.$xhr$.abort( ).dispose( ); self.$xhr$ = null; }
self.$mID$ = null;
self.$queue$ = null;
return __super__.dispose.call( self );
};
RT.Client.Poll[PROTO].abort = function( trigger ){
Client_Poll[PROTO].abort = function( trigger ){
var self = this;
if ( self.$timer$ ) { clearTimeout( self.$timer$ ); self.$timer$ = null; }
if ( self.$xhr$ ) { self.$xhr$.abort( ).dispose( ); self.$xhr$ = null; }
return __super__.abort.call( self, true===trigger );
};
RT.Client.Poll[PROTO].send = function( payload ){
Client_Poll[PROTO].send = function( payload ){
var self = this;
self.$queue$.push( String(payload) );
return self;
};
RT.Client.Poll[PROTO].listen = function( ){
Client_Poll[PROTO].listen = function( ){
var self = this;
var poll = function poll( ) {
var asUrlEncoded = 'urlencoded' === self.$cfg$.contentType, asXML = 'xml' === self.$cfg$.contentType,
Expand Down Expand Up @@ -96,7 +96,7 @@ RT.Client.Poll[PROTO].listen = function( ){
rt_payload = rt_msgs.join( rt_msg );
}
}
self.$xhr$ = XHR.create({
self.$xhr$ = RT_XHR.create({
url : self.$cfg$.endpoint + (-1 < self.$cfg$.endpoint.indexOf('?') ? '&' : '?') + '__nocache__='+(new Date().getTime()),
method : 'POST',
responseType : /*asXML ? 'xml' :*/ 'text',
Expand Down
Loading

0 comments on commit 667e834

Please sign in to comment.