Skip to content

Commit d915bb7

Browse files
author
Devendra
committed
v4 with jsonp
1 parent 5a6a280 commit d915bb7

25 files changed

Lines changed: 779 additions & 731 deletions

File tree

core/pubnub-common.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1688,8 +1688,8 @@ function PN_API(setup) {
16881688
}
16891689
else {
16901690
// New Origin on Failed Connection
1691-
//STD_ORIGIN = nextorigin( ORIGINS || ORIGIN, ++cur );
1692-
//SUB_ORIGIN = nextorigin( ORIGINS || ORIGIN, cur );
1691+
STD_ORIGIN = nextorigin( ORIGINS || ORIGIN, ++cur );
1692+
SUB_ORIGIN = nextorigin( ORIGINS || ORIGIN, cur );
16931693

16941694
// Re-test Connection
16951695
timeout( function() {

modern/pubnub.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1689,8 +1689,8 @@ function PN_API(setup) {
16891689
}
16901690
else {
16911691
// New Origin on Failed Connection
1692-
//STD_ORIGIN = nextorigin( ORIGINS || ORIGIN, ++cur );
1693-
//SUB_ORIGIN = nextorigin( ORIGINS || ORIGIN, cur );
1692+
STD_ORIGIN = nextorigin( ORIGINS || ORIGIN, ++cur );
1693+
SUB_ORIGIN = nextorigin( ORIGINS || ORIGIN, cur );
16941694

16951695
// Re-test Connection
16961696
timeout( function() {

modern/pubnub.min.js

Lines changed: 79 additions & 79 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

node.js/pubnub.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1689,8 +1689,8 @@ function PN_API(setup) {
16891689
}
16901690
else {
16911691
// New Origin on Failed Connection
1692-
//STD_ORIGIN = nextorigin( ORIGINS || ORIGIN, ++cur );
1693-
//SUB_ORIGIN = nextorigin( ORIGINS || ORIGIN, cur );
1692+
STD_ORIGIN = nextorigin( ORIGINS || ORIGIN, ++cur );
1693+
SUB_ORIGIN = nextorigin( ORIGINS || ORIGIN, cur );
16941694

16951695
// Re-test Connection
16961696
timeout( function() {

phonegap/pubnub.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1689,8 +1689,8 @@ function PN_API(setup) {
16891689
}
16901690
else {
16911691
// New Origin on Failed Connection
1692-
//STD_ORIGIN = nextorigin( ORIGINS || ORIGIN, ++cur );
1693-
//SUB_ORIGIN = nextorigin( ORIGINS || ORIGIN, cur );
1692+
STD_ORIGIN = nextorigin( ORIGINS || ORIGIN, ++cur );
1693+
SUB_ORIGIN = nextorigin( ORIGINS || ORIGIN, cur );
16941694

16951695
// Re-test Connection
16961696
timeout( function() {

phonegap/pubnub.min.js

Lines changed: 79 additions & 79 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sencha/pubnub.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1689,8 +1689,8 @@ function PN_API(setup) {
16891689
}
16901690
else {
16911691
// New Origin on Failed Connection
1692-
//STD_ORIGIN = nextorigin( ORIGINS || ORIGIN, ++cur );
1693-
//SUB_ORIGIN = nextorigin( ORIGINS || ORIGIN, cur );
1692+
STD_ORIGIN = nextorigin( ORIGINS || ORIGIN, ++cur );
1693+
SUB_ORIGIN = nextorigin( ORIGINS || ORIGIN, cur );
16941694

16951695
// Re-test Connection
16961696
timeout( function() {

sencha/pubnub.min.js

Lines changed: 79 additions & 79 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

smart-tv/pubnub.js

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1839,8 +1839,8 @@ function PN_API(setup) {
18391839
}
18401840
else {
18411841
// New Origin on Failed Connection
1842-
//STD_ORIGIN = nextorigin( ORIGINS || ORIGIN, ++cur );
1843-
//SUB_ORIGIN = nextorigin( ORIGINS || ORIGIN, cur );
1842+
STD_ORIGIN = nextorigin( ORIGINS || ORIGIN, ++cur );
1843+
SUB_ORIGIN = nextorigin( ORIGINS || ORIGIN, cur );
18441844

18451845
// Re-test Connection
18461846
timeout( function() {
@@ -4148,16 +4148,28 @@ function xdr( setup ) {
41484148
, timer = timeout( function(){done(1, {"message" : "timeout"})}, xhrtme )
41494149
, fail = setup.fail || function(){}
41504150
, data = setup.data || {}
4151+
, http_data = {'request' : {}, 'response' : {}}
41514152
, success = setup.success || function(){}
41524153
, append = function() { head().appendChild(script) }
4153-
, done = function( failed, response ) {
4154+
, mode = setup['mode'] || 'GET'
4155+
, add_request_data = function(r) {
4156+
r['method'] = mode;
4157+
r['url'] = script.src;
4158+
return r;
4159+
}
4160+
, done = function( failed, response, http_data) {
41544161
if (finished) return;
41554162
finished = 1;
41564163

41574164
script.onerror = null;
41584165
clearTimeout(timer);
41594166

4160-
(failed || !response) || success(response);
4167+
if (http_data && response) {
4168+
http_data['response']['data'] = response;
4169+
http_data['response']['status'] = response.status || 200;
4170+
}
4171+
4172+
(failed || !response) || success(response, http_data);
41614173

41624174
timeout( function() {
41634175
failed && fail();
@@ -4168,12 +4180,12 @@ function xdr( setup ) {
41684180
};
41694181

41704182
window[callback] = function(response) {
4171-
done( 0, response );
4183+
done( 0, response, http_data);
41724184
};
41734185

41744186
if (!setup.blocking) script[ASYNC] = ASYNC;
41754187

4176-
script.onerror = function() { done(1) };
4188+
script.onerror = function() { done(1, null, http_data) };
41774189
script.src = build_url( setup.url, data );
41784190

41794191
attr( script, 'id', id );

0 commit comments

Comments
 (0)