Comparing version 4.0.3 to 4.0.4
{ | ||
"name": "pubnub", | ||
"version": "4.0.3", | ||
"version": "4.0.4", | ||
"main": "dist/web/pubnub.min.js", | ||
@@ -5,0 +5,0 @@ "license": "https://github.com/pubnub/javascript/blob/master/LICENSE", |
@@ -57,2 +57,16 @@ 'use strict'; | ||
} | ||
}, { | ||
key: 'announceConnectionRestored', | ||
value: function announceConnectionRestored() { | ||
var reconnectedStatus = {}; | ||
reconnectedStatus.category = 'PNReconnectedCategory'; | ||
this.announceStatus(reconnectedStatus); | ||
} | ||
}, { | ||
key: 'announceNetworkIssues', | ||
value: function announceNetworkIssues() { | ||
var disconnectedStatus = {}; | ||
disconnectedStatus.category = 'PNNetworkIssuesCategory'; | ||
this.announceStatus(disconnectedStatus); | ||
} | ||
}]); | ||
@@ -59,0 +73,0 @@ |
@@ -80,6 +80,4 @@ 'use strict'; | ||
_this.reconnect(); | ||
var reconnectedStatus = {}; | ||
reconnectedStatus.category = 'PNReconnectedCategory'; | ||
_this._subscriptionStatusAnnounced = true; | ||
_this._listenerManager.announceStatus(reconnectedStatus); | ||
_this._listenerManager.announceConnectionRestored(); | ||
}); | ||
@@ -307,3 +305,4 @@ } | ||
announce.subscribedChannel = subscriptionMatch != null ? subscriptionMatch : channel; | ||
announce.action = message.payload.action; | ||
announce.state = message.payload.data; | ||
announce.timetoken = publishMetaData.publishTimetoken; | ||
@@ -310,0 +309,0 @@ announce.occupancy = message.payload.occupancy; |
@@ -9,2 +9,6 @@ 'use strict'; | ||
var _uuid = require('uuid'); | ||
var _uuid2 = _interopRequireDefault(_uuid); | ||
var _networking = require('./components/networking'); | ||
@@ -145,3 +149,3 @@ | ||
var modules = { config: config, networking: networking, crypto: crypto }; | ||
var listenerManager = new _listener_manager2.default(); | ||
var listenerManager = this._listenerManager = new _listener_manager2.default(); | ||
@@ -220,2 +224,7 @@ var timeEndpoint = _endpoint2.default.bind(this, modules, timeEndpointConfig); | ||
} | ||
}], [{ | ||
key: 'generateUUID', | ||
value: function generateUUID() { | ||
return _uuid2.default.v4(); | ||
} | ||
}]); | ||
@@ -222,0 +231,0 @@ |
@@ -56,4 +56,11 @@ 'use strict'; | ||
window.addEventListener('offline', _this.stop.bind(_this)); | ||
window.addEventListener('online', _this.reconnect.bind(_this)); | ||
window.addEventListener('offline', function () { | ||
_this._listenerManager.announceNetworkIssues(); | ||
_this.stop.bind(_this); | ||
}); | ||
window.addEventListener('online', function () { | ||
_this._listenerManager.announceConnectionRestored(); | ||
_this.reconnect.bind(_this); | ||
}); | ||
return _this; | ||
@@ -60,0 +67,0 @@ } |
{ | ||
"name": "pubnub", | ||
"preferGlobal": false, | ||
"version": "4.0.3", | ||
"version": "4.0.4", | ||
"author": "PubNub <support@pubnub.com>", | ||
@@ -12,2 +12,3 @@ "description": "Publish & Subscribe Real-time Messaging with PubNub", | ||
"main": "./lib/node/index.js", | ||
"react-native": "./lib/node/index.js", | ||
"browser": "./dist/web/pubnub.min.js", | ||
@@ -79,2 +80,3 @@ "repository": { | ||
"uglify-js": "^2.6.4", | ||
"underscore": "^1.8.3", | ||
"webpack": "^1.13.1", | ||
@@ -81,0 +83,0 @@ "webpack-dev-server": "1.14.1", |
@@ -22,7 +22,7 @@ # PubNub JavaScript SDK (V4) | ||
#### HTTP | ||
* http://cdn.pubnub.com/sdk/javascript/pubnub.4.0.3.min.js | ||
* http://cdn.pubnub.com/sdk/javascript/pubnub.4.0.3.js | ||
* http://cdn.pubnub.com/sdk/javascript/pubnub.4.0.4.min.js | ||
* http://cdn.pubnub.com/sdk/javascript/pubnub.4.0.4.js | ||
#### HTTPS | ||
* https://cdn.pubnub.com/sdk/javascript/pubnub.4.0.3.min.js | ||
* https://cdn.pubnub.com/sdk/javascript/pubnub.4.0.3.js | ||
* https://cdn.pubnub.com/sdk/javascript/pubnub.4.0.4.min.js | ||
* https://cdn.pubnub.com/sdk/javascript/pubnub.4.0.4.js |
@@ -44,2 +44,14 @@ /* @flow */ | ||
announceConnectionRestored() { | ||
let reconnectedStatus: StatusAnnouncement = {}; | ||
reconnectedStatus.category = 'PNReconnectedCategory'; | ||
this.announceStatus(reconnectedStatus); | ||
} | ||
announceNetworkIssues() { | ||
let disconnectedStatus: StatusAnnouncement = {}; | ||
disconnectedStatus.category = 'PNNetworkIssuesCategory'; | ||
this.announceStatus(disconnectedStatus); | ||
} | ||
} |
@@ -86,6 +86,4 @@ | ||
this.reconnect(); | ||
let reconnectedStatus: StatusAnnouncement = {}; | ||
reconnectedStatus.category = 'PNReconnectedCategory'; | ||
this._subscriptionStatusAnnounced = true; | ||
this._listenerManager.announceStatus(reconnectedStatus); | ||
this._listenerManager.announceConnectionRestored(); | ||
}); | ||
@@ -270,3 +268,4 @@ } | ||
announce.subscribedChannel = subscriptionMatch != null ? subscriptionMatch : channel; | ||
// announce.state = message.payload.getData()) | ||
announce.action = message.payload.action; | ||
announce.state = message.payload.data; | ||
announce.timetoken = publishMetaData.publishTimetoken; | ||
@@ -273,0 +272,0 @@ announce.occupancy = message.payload.occupancy; |
@@ -22,7 +22,7 @@ /* @flow */ | ||
export function getRequestTimeout({ config }: ModulesInject) { | ||
export function getRequestTimeout({ config }: ModulesInject): number { | ||
return config.getTransactionTimeout(); | ||
} | ||
export function isAuthSupported() { | ||
export function isAuthSupported(): boolean { | ||
return true; | ||
@@ -29,0 +29,0 @@ } |
@@ -24,7 +24,7 @@ /* @flow */ | ||
export function getRequestTimeout({ config }: ModulesInject) { | ||
export function getRequestTimeout({ config }: ModulesInject): number { | ||
return config.getTransactionTimeout(); | ||
} | ||
export function isAuthSupported() { | ||
export function isAuthSupported(): boolean { | ||
return true; | ||
@@ -31,0 +31,0 @@ } |
/* @flow */ | ||
import uuidGenerator from 'uuid'; | ||
import Networking from './components/networking'; | ||
@@ -44,2 +46,3 @@ import Config from './components/config'; | ||
_config: Config; | ||
_listenerManager: ListenerManager; | ||
@@ -92,3 +95,3 @@ // tell flow about the mounted endpoint | ||
let modules = { config, networking, crypto }; | ||
const listenerManager = new ListenerManager(); | ||
const listenerManager = this._listenerManager = new ListenerManager(); | ||
@@ -167,4 +170,10 @@ // new | ||
getVersion(): String { return packageJSON.version; } | ||
getVersion(): String { | ||
return packageJSON.version; | ||
} | ||
static generateUUID(): string { | ||
return uuidGenerator.v4(); | ||
} | ||
} |
@@ -41,6 +41,13 @@ /* @flow */ | ||
// mount network events. | ||
window.addEventListener('offline', this.stop.bind(this)); | ||
window.addEventListener('online', this.reconnect.bind(this)); | ||
window.addEventListener('offline', () => { | ||
this._listenerManager.announceNetworkIssues(); | ||
this.stop.bind(this); | ||
}); | ||
window.addEventListener('online', () => { | ||
this._listenerManager.announceConnectionRestored(); | ||
this.reconnect.bind(this); | ||
}); | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1125622
138
11474
48