Comparing version 4.7.0 to 4.8.0
## [v4.8.0](https://github.com/pubnub/javascript/tree/v4.8.0) | ||
[Full Changelog](https://github.com/pubnub/javascript/compare/v4.7.0...v4.8.0) | ||
- 🌟allow manual control over network state via listenToBrowserNetworkEvents | ||
## [v4.7.0](https://github.com/pubnub/javascript/tree/v4.7.0) | ||
@@ -3,0 +13,0 @@ |
@@ -1,1 +0,1 @@ | ||
{"errors":[],"warnings":[],"version":"1.14.0","hash":"44ba01872161a6b61086","publicPath":"","assetsByChunkName":{"main":"pubnub.js"},"assets":[{"name":"pubnub.js","size":147312,"chunks":[0],"chunkNames":["main"],"emitted":true},{"name":"stats.json","size":0,"chunks":[],"chunkNames":[]}],"chunks":[{"id":0,"rendered":true,"initial":true,"entry":true,"extraAsync":false,"size":140228,"names":["main"],"files":["pubnub.js"],"hash":"9c309308b421b8b77d54","parents":[],"modules":[],"filteredModules":43,"origins":[{"moduleId":0,"module":"/Users/Max/Desktop/CLIENT_CONTROL/javascript/node_modules/babel-loader/lib/index.js!/Users/Max/Desktop/CLIENT_CONTROL/javascript/src/titanium/index.js","moduleIdentifier":"/Users/Max/Desktop/CLIENT_CONTROL/javascript/node_modules/babel-loader/lib/index.js!/Users/Max/Desktop/CLIENT_CONTROL/javascript/src/titanium/index.js","moduleName":"./src/titanium/index.js","loc":"","name":"main","reasons":[]}]}],"modules":[],"filteredModules":43,"children":[]} | ||
{"errors":[],"warnings":[],"version":"1.14.0","hash":"55ae2f11609be179e06a","publicPath":"","assetsByChunkName":{"main":"pubnub.js"},"assets":[{"name":"pubnub.js","size":147371,"chunks":[0],"chunkNames":["main"],"emitted":true},{"name":"stats.json","size":0,"chunks":[],"chunkNames":[]}],"chunks":[{"id":0,"rendered":true,"initial":true,"entry":true,"extraAsync":false,"size":140287,"names":["main"],"files":["pubnub.js"],"hash":"dc009d2f3e552db012c8","parents":[],"modules":[],"filteredModules":43,"origins":[{"moduleId":0,"module":"/Users/Max/Desktop/CLIENT_CONTROL/javascript/node_modules/babel-loader/lib/index.js!/Users/Max/Desktop/CLIENT_CONTROL/javascript/src/titanium/index.js","moduleIdentifier":"/Users/Max/Desktop/CLIENT_CONTROL/javascript/node_modules/babel-loader/lib/index.js!/Users/Max/Desktop/CLIENT_CONTROL/javascript/src/titanium/index.js","moduleName":"./src/titanium/index.js","loc":"","name":"main","reasons":[]}]}],"modules":[],"filteredModules":43,"children":[]} |
@@ -1,1 +0,1 @@ | ||
{"errors":[],"warnings":[],"version":"1.14.0","hash":"fe892a79e075d1b19470","publicPath":"","assetsByChunkName":{"main":"pubnub.js"},"assets":[{"name":"pubnub.js","size":181311,"chunks":[0],"chunkNames":["main"],"emitted":true},{"name":"stats.json","size":0,"chunks":[],"chunkNames":[]}],"chunks":[{"id":0,"rendered":true,"initial":true,"entry":true,"extraAsync":false,"size":172568,"names":["main"],"files":["pubnub.js"],"hash":"897114e4db69c8caad71","parents":[],"modules":[],"filteredModules":48,"origins":[{"moduleId":0,"module":"/Users/Max/Desktop/CLIENT_CONTROL/javascript/node_modules/babel-loader/lib/index.js!/Users/Max/Desktop/CLIENT_CONTROL/javascript/src/web/index.js","moduleIdentifier":"/Users/Max/Desktop/CLIENT_CONTROL/javascript/node_modules/babel-loader/lib/index.js!/Users/Max/Desktop/CLIENT_CONTROL/javascript/src/web/index.js","moduleName":"./src/web/index.js","loc":"","name":"main","reasons":[]}]}],"modules":[],"filteredModules":48,"children":[]} | ||
{"errors":[],"warnings":[],"version":"1.14.0","hash":"7500975803a3253cde94","publicPath":"","assetsByChunkName":{"main":"pubnub.js"},"assets":[{"name":"pubnub.js","size":181605,"chunks":[0],"chunkNames":["main"],"emitted":true},{"name":"stats.json","size":0,"chunks":[],"chunkNames":[]}],"chunks":[{"id":0,"rendered":true,"initial":true,"entry":true,"extraAsync":false,"size":172858,"names":["main"],"files":["pubnub.js"],"hash":"8d38d0fc1b8ae81ec64a","parents":[],"modules":[],"filteredModules":48,"origins":[{"moduleId":0,"module":"/Users/Max/Desktop/CLIENT_CONTROL/javascript/node_modules/babel-loader/lib/index.js!/Users/Max/Desktop/CLIENT_CONTROL/javascript/src/web/index.js","moduleIdentifier":"/Users/Max/Desktop/CLIENT_CONTROL/javascript/node_modules/babel-loader/lib/index.js!/Users/Max/Desktop/CLIENT_CONTROL/javascript/src/web/index.js","moduleName":"./src/web/index.js","loc":"","name":"main","reasons":[]}]}],"modules":[],"filteredModules":48,"children":[]} |
@@ -80,8 +80,4 @@ /* eslint no-console: 0, arrow-body-style: 0 */ | ||
.pipe(uglify({ mangle: true, compress: true })) | ||
.pipe(rename('pubnub.min.js')) | ||
.pipe(gulp.dest('dist/titanium')) | ||
.pipe(rename(`pubnub.${packageJSON.version}.min.js`)) | ||
.pipe(gulp.dest('upload/normal')); | ||
.pipe(gulp.dest('dist/titanium')); | ||
}); | ||
@@ -88,0 +84,0 @@ |
@@ -168,3 +168,3 @@ 'use strict'; | ||
value: function getVersion() { | ||
return '4.7.0'; | ||
return '4.8.0'; | ||
} | ||
@@ -171,0 +171,0 @@ }, { |
@@ -144,3 +144,3 @@ 'use strict'; | ||
key: 'adaptUnsubscribeChange', | ||
value: function adaptUnsubscribeChange(args) { | ||
value: function adaptUnsubscribeChange(args, isOffline) { | ||
var _this3 = this; | ||
@@ -164,3 +164,3 @@ | ||
if (this._config.suppressLeaveEvents === false) { | ||
if (this._config.suppressLeaveEvents === false && !isOffline) { | ||
this._leaveEndpoint({ channels: channels, channelGroups: channelGroups }, function (status) { | ||
@@ -186,4 +186,4 @@ status.affectedChannels = channels; | ||
key: 'unsubscribeAll', | ||
value: function unsubscribeAll() { | ||
this.adaptUnsubscribeChange({ channels: this.getSubscribedChannels(), channelGroups: this.getSubscribedChannelGroups() }); | ||
value: function unsubscribeAll(isOffline) { | ||
this.adaptUnsubscribeChange({ channels: this.getSubscribedChannels(), channelGroups: this.getSubscribedChannelGroups() }, isOffline); | ||
} | ||
@@ -190,0 +190,0 @@ }, { |
@@ -218,4 +218,4 @@ 'use strict'; | ||
this.destroy = function () { | ||
subscriptionManager.unsubscribeAll(); | ||
this.destroy = function (isOffline) { | ||
subscriptionManager.unsubscribeAll(isOffline); | ||
subscriptionManager.disconnect(); | ||
@@ -249,4 +249,4 @@ }; | ||
}, { | ||
key: '__networkDownDetected', | ||
value: function __networkDownDetected() { | ||
key: 'networkDownDetected', | ||
value: function networkDownDetected() { | ||
this._listenerManager.announceNetworkDown(); | ||
@@ -257,8 +257,8 @@ | ||
} else { | ||
this.destroy(); | ||
this.destroy(true); | ||
} | ||
} | ||
}, { | ||
key: '__networkUpDetected', | ||
value: function __networkUpDetected() { | ||
key: 'networkUpDetected', | ||
value: function networkUpDetected() { | ||
this._listenerManager.announceNetworkUp(); | ||
@@ -265,0 +265,0 @@ this.reconnect(); |
@@ -45,2 +45,6 @@ 'use strict'; | ||
var _setup$listenToBrowse = setup.listenToBrowserNetworkEvents, | ||
listenToBrowserNetworkEvents = _setup$listenToBrowse === undefined ? true : _setup$listenToBrowse; | ||
setup.db = _web2.default; | ||
@@ -52,9 +56,11 @@ setup.sdkFamily = 'Web'; | ||
window.addEventListener('offline', function () { | ||
_this.__networkDownDetected(); | ||
}); | ||
if (listenToBrowserNetworkEvents) { | ||
window.addEventListener('offline', function () { | ||
_this.networkDownDetected(); | ||
}); | ||
window.addEventListener('online', function () { | ||
_this.__networkUpDetected(); | ||
}); | ||
window.addEventListener('online', function () { | ||
_this.networkUpDetected(); | ||
}); | ||
} | ||
return _this; | ||
@@ -61,0 +67,0 @@ } |
{ | ||
"name": "pubnub", | ||
"version": "4.7.0", | ||
"version": "4.8.0", | ||
"author": "PubNub <support@pubnub.com>", | ||
@@ -5,0 +5,0 @@ "description": "Publish & Subscribe Real-time Messaging with PubNub", |
@@ -22,3 +22,3 @@ # PubNub JavaScript SDK (V4) | ||
## CDN Links | ||
* https://cdn.pubnub.com/sdk/javascript/pubnub.4.7.0.min.js | ||
* https://cdn.pubnub.com/sdk/javascript/pubnub.4.7.0.js | ||
* https://cdn.pubnub.com/sdk/javascript/pubnub.4.8.0.min.js | ||
* https://cdn.pubnub.com/sdk/javascript/pubnub.4.8.0.js |
@@ -199,3 +199,3 @@ /* @flow */ | ||
getVersion(): string { | ||
return '4.7.0'; | ||
return '4.8.0'; | ||
} | ||
@@ -202,0 +202,0 @@ |
@@ -144,3 +144,3 @@ /* @flow */ | ||
adaptUnsubscribeChange(args: UnsubscribeArgs) { | ||
adaptUnsubscribeChange(args: UnsubscribeArgs, isOffline: boolean) { | ||
const { channels = [], channelGroups = [] } = args; | ||
@@ -158,3 +158,3 @@ | ||
if (this._config.suppressLeaveEvents === false) { | ||
if (this._config.suppressLeaveEvents === false && !isOffline) { | ||
this._leaveEndpoint({ channels, channelGroups }, (status) => { | ||
@@ -183,4 +183,4 @@ status.affectedChannels = channels; | ||
unsubscribeAll() { | ||
this.adaptUnsubscribeChange({ channels: this.getSubscribedChannels(), channelGroups: this.getSubscribedChannelGroups() }); | ||
unsubscribeAll(isOffline: boolean) { | ||
this.adaptUnsubscribeChange({ channels: this.getSubscribedChannels(), channelGroups: this.getSubscribedChannelGroups() }, isOffline); | ||
} | ||
@@ -187,0 +187,0 @@ |
@@ -180,4 +180,4 @@ /* @flow */ | ||
this.destroy = () => { | ||
subscriptionManager.unsubscribeAll(); | ||
this.destroy = (isOffline: boolean) => { | ||
subscriptionManager.unsubscribeAll(isOffline); | ||
subscriptionManager.disconnect(); | ||
@@ -215,3 +215,3 @@ }; | ||
// network hooks to indicate network changes | ||
__networkDownDetected() { | ||
networkDownDetected() { | ||
this._listenerManager.announceNetworkDown(); | ||
@@ -222,7 +222,7 @@ | ||
} else { | ||
this.destroy(); | ||
this.destroy(true); | ||
} | ||
} | ||
__networkUpDetected() { | ||
networkUpDetected() { | ||
this._listenerManager.announceNetworkUp(); | ||
@@ -229,0 +229,0 @@ this.reconnect(); |
@@ -20,2 +20,5 @@ /* @flow */ | ||
constructor(setup: InternalSetupStruct) { | ||
// extract config. | ||
const { listenToBrowserNetworkEvents = true } = setup; | ||
setup.db = db; | ||
@@ -27,12 +30,14 @@ setup.sdkFamily = 'Web'; | ||
// mount network events. | ||
window.addEventListener('offline', () => { | ||
this.__networkDownDetected(); | ||
}); | ||
if (listenToBrowserNetworkEvents) { | ||
// mount network events. | ||
window.addEventListener('offline', () => { | ||
this.networkDownDetected(); | ||
}); | ||
window.addEventListener('online', () => { | ||
this.__networkUpDetected(); | ||
}); | ||
window.addEventListener('online', () => { | ||
this.networkUpDetected(); | ||
}); | ||
} | ||
} | ||
} |
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 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
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
2620218
47661
3