Skip to content

Commit 52ecf5f

Browse files
author
Max Presman
committed
compiled files
1 parent 2901251 commit 52ecf5f

File tree

10 files changed

+66
-54
lines changed

10 files changed

+66
-54
lines changed

dist/titanium/pubnub.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -326,8 +326,8 @@ return /******/ (function(modules) { // webpackBootstrap
326326
this.disconnect = subscriptionManager.disconnect.bind(subscriptionManager);
327327
this.reconnect = subscriptionManager.reconnect.bind(subscriptionManager);
328328

329-
this.destroy = function () {
330-
subscriptionManager.unsubscribeAll();
329+
this.destroy = function (isOffline) {
330+
subscriptionManager.unsubscribeAll(isOffline);
331331
subscriptionManager.disconnect();
332332
};
333333

@@ -356,19 +356,19 @@ return /******/ (function(modules) { // webpackBootstrap
356356
return this._config.getVersion();
357357
}
358358
}, {
359-
key: '__networkDownDetected',
360-
value: function __networkDownDetected() {
359+
key: 'networkDownDetected',
360+
value: function networkDownDetected() {
361361
this._listenerManager.announceNetworkDown();
362362

363363
if (this._config.restore) {
364364
this.disconnect();
365365
} else {
366-
this.destroy();
366+
this.destroy(true);
367367
}
368368
}
369369
}, {
370-
key: '__networkUpDetected',
371-
value: function __networkUpDetected() {
370+
key: 'networkUpDetected',
371+
value: function networkUpDetected() {
372372
this._listenerManager.announceNetworkUp();
373373
this.reconnect();
374374
}
@@ -1579,7 +1579,7 @@ return /******/ (function(modules) { // webpackBootstrap
15791579
}
15801580
}, {
15811581
key: 'adaptUnsubscribeChange',
1582-
value: function adaptUnsubscribeChange(args) {
1582+
value: function adaptUnsubscribeChange(args, isOffline) {
15831583
var _this3 = this;
15841584

15851585
var _args$channels3 = args.channels,
@@ -1598,7 +1598,7 @@ return /******/ (function(modules) { // webpackBootstrap
15981598
if (channelGroup in _this3._presenceChannelGroups) delete _this3._channelGroups[channelGroup];
15991599
});
16001600

1601-
if (this._config.suppressLeaveEvents === false) {
1601+
if (this._config.suppressLeaveEvents === false && !isOffline) {
16021602
this._leaveEndpoint({ channels: channels, channelGroups: channelGroups }, function (status) {
16031603
status.affectedChannels = channels;
16041604
status.affectedChannelGroups = channelGroups;
@@ -1619,8 +1619,8 @@ return /******/ (function(modules) { // webpackBootstrap
16191619
}
16201620
}, {
16211621
key: 'unsubscribeAll',
1622-
value: function unsubscribeAll() {
1623-
this.adaptUnsubscribeChange({ channels: this.getSubscribedChannels(), channelGroups: this.getSubscribedChannelGroups() });
1622+
value: function unsubscribeAll(isOffline) {
1623+
this.adaptUnsubscribeChange({ channels: this.getSubscribedChannels(), channelGroups: this.getSubscribedChannelGroups() }, isOffline);
16241624
}
16251625
}, {
16261626
key: 'getSubscribedChannels',

dist/titanium/pubnub.min.js

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

dist/web/pubnub.js

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -99,19 +99,25 @@ return /******/ (function(modules) { // webpackBootstrap
9999
function _class(setup) {
100100
_classCallCheck(this, _class);
101101

102+
var _setup$listenToBrowse = setup.listenToBrowserNetworkEvents,
103+
listenToBrowserNetworkEvents = _setup$listenToBrowse === undefined ? true : _setup$listenToBrowse;
104+
105+
102106
setup.db = _web2.default;
103107
setup.sdkFamily = 'Web';
104108
setup.networking = new _networking2.default({ get: _webNode.get, post: _webNode.post, sendBeacon: sendBeacon });
105109

106110
var _this = _possibleConstructorReturn(this, (_class.__proto__ || Object.getPrototypeOf(_class)).call(this, setup));
107111

108-
window.addEventListener('offline', function () {
109-
_this.__networkDownDetected();
110-
});
112+
if (listenToBrowserNetworkEvents) {
113+
window.addEventListener('offline', function () {
114+
_this.networkDownDetected();
115+
});
111116

112-
window.addEventListener('online', function () {
113-
_this.__networkUpDetected();
114-
});
117+
window.addEventListener('online', function () {
118+
_this.networkUpDetected();
119+
});
120+
}
115121
return _this;
116122
}
117123

@@ -342,8 +348,8 @@ return /******/ (function(modules) { // webpackBootstrap
342348
this.disconnect = subscriptionManager.disconnect.bind(subscriptionManager);
343349
this.reconnect = subscriptionManager.reconnect.bind(subscriptionManager);
344350

345-
this.destroy = function () {
346-
subscriptionManager.unsubscribeAll();
351+
this.destroy = function (isOffline) {
352+
subscriptionManager.unsubscribeAll(isOffline);
347353
subscriptionManager.disconnect();
348354
};
349355

@@ -372,19 +378,19 @@ return /******/ (function(modules) { // webpackBootstrap
372378
return this._config.getVersion();
373379
}
374380
}, {
375-
key: '__networkDownDetected',
376-
value: function __networkDownDetected() {
381+
key: 'networkDownDetected',
382+
value: function networkDownDetected() {
377383
this._listenerManager.announceNetworkDown();
378384

379385
if (this._config.restore) {
380386
this.disconnect();
381387
} else {
382-
this.destroy();
388+
this.destroy(true);
383389
}
384390
}
385391
}, {
386-
key: '__networkUpDetected',
387-
value: function __networkUpDetected() {
392+
key: 'networkUpDetected',
393+
value: function networkUpDetected() {
388394
this._listenerManager.announceNetworkUp();
389395
this.reconnect();
390396
}
@@ -1595,7 +1601,7 @@ return /******/ (function(modules) { // webpackBootstrap
15951601
}
15961602
}, {
15971603
key: 'adaptUnsubscribeChange',
1598-
value: function adaptUnsubscribeChange(args) {
1604+
value: function adaptUnsubscribeChange(args, isOffline) {
15991605
var _this3 = this;
16001606

16011607
var _args$channels3 = args.channels,
@@ -1614,7 +1620,7 @@ return /******/ (function(modules) { // webpackBootstrap
16141620
if (channelGroup in _this3._presenceChannelGroups) delete _this3._channelGroups[channelGroup];
16151621
});
16161622

1617-
if (this._config.suppressLeaveEvents === false) {
1623+
if (this._config.suppressLeaveEvents === false && !isOffline) {
16181624
this._leaveEndpoint({ channels: channels, channelGroups: channelGroups }, function (status) {
16191625
status.affectedChannels = channels;
16201626
status.affectedChannelGroups = channelGroups;
@@ -1635,8 +1641,8 @@ return /******/ (function(modules) { // webpackBootstrap
16351641
}
16361642
}, {
16371643
key: 'unsubscribeAll',
1638-
value: function unsubscribeAll() {
1639-
this.adaptUnsubscribeChange({ channels: this.getSubscribedChannels(), channelGroups: this.getSubscribedChannelGroups() });
1644+
value: function unsubscribeAll(isOffline) {
1645+
this.adaptUnsubscribeChange({ channels: this.getSubscribedChannels(), channelGroups: this.getSubscribedChannelGroups() }, isOffline);
16401646
}
16411647
}, {
16421648
key: 'getSubscribedChannels',

dist/web/pubnub.min.js

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

lib/core/components/subscription_manager.js

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

lib/core/components/subscription_manager.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/core/pubnub-common.js

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

0 commit comments

Comments
 (0)