Skip to content

Commit f735cf2

Browse files
committed
dist/lib
1 parent 7a7d1e7 commit f735cf2

File tree

7 files changed

+57
-21
lines changed

7 files changed

+57
-21
lines changed

dist/web/pubnub.js

Lines changed: 28 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2565,13 +2565,17 @@
25652565
return latencies;
25662566
};
25672567
default_1.prototype.startLatencyMeasure = function (operationType, identifier) {
2568-
if (operationType === OPERATIONS.PNSubscribeOperation || !identifier) {
2568+
if (operationType === OPERATIONS.PNSubscribeOperation ||
2569+
OPERATIONS.PNReceiveMessagesOperation ||
2570+
!identifier) {
25692571
return;
25702572
}
25712573
this._trackedLatencies[identifier] = Date.now();
25722574
};
25732575
default_1.prototype.stopLatencyMeasure = function (operationType, identifier) {
2574-
if (operationType === OPERATIONS.PNSubscribeOperation || !identifier) {
2576+
if (operationType === OPERATIONS.PNSubscribeOperation ||
2577+
OPERATIONS.PNReceiveMessagesOperation ||
2578+
!identifier) {
25752579
return;
25762580
}
25772581
var endpointName = this._endpointName(operationType);
@@ -6731,8 +6735,9 @@
67316735
},
67326736
getURL: function (_a, params) {
67336737
var config = _a.config;
6734-
var channelsString = params.channels ? params.channels.join(',') : ',';
6735-
return "/v2/subscribe/".concat(config.subscribeKey, "/").concat(utils$5.encodeString(channelsString), "/0");
6738+
var _b = params.channels, channels = _b === void 0 ? [] : _b;
6739+
var stringifiedChannels = channels.length > 0 ? channels.join(',') : ',';
6740+
return "/v2/subscribe/".concat(config.subscribeKey, "/").concat(utils$5.encodeString(stringifiedChannels), "/0");
67366741
},
67376742
getRequestTimeout: function (_a) {
67386743
var config = _a.config;
@@ -6775,8 +6780,9 @@
67756780
},
67766781
getURL: function (_a, params) {
67776782
var config = _a.config;
6778-
var channelsString = params.channels ? params.channels.join(',') : ',';
6779-
return "/v2/subscribe/".concat(config.subscribeKey, "/").concat(utils$5.encodeString(channelsString), "/0");
6783+
var _b = params.channels, channels = _b === void 0 ? [] : _b;
6784+
var stringifiedChannels = channels.length > 0 ? channels.join(',') : ',';
6785+
return "/v2/subscribe/".concat(config.subscribeKey, "/").concat(utils$5.encodeString(stringifiedChannels), "/0");
67806786
},
67816787
getRequestTimeout: function (_a) {
67826788
var config = _a.config;
@@ -7726,8 +7732,8 @@
77267732
EventEngine.prototype.subscribe = function (_a) {
77277733
var _this = this;
77287734
var channels = _a.channels, channelGroups = _a.channelGroups, timetoken = _a.timetoken, withPresence = _a.withPresence;
7729-
this.channels = __spreadArray(__spreadArray([], __read(this.channels), false), __read((channels !== null && channels !== void 0 ? channels : [])), false);
7730-
this.groups = __spreadArray(__spreadArray([], __read(this.groups), false), __read((channelGroups !== null && channelGroups !== void 0 ? channelGroups : [])), false);
7735+
this.channels = Array.from(new Set(__spreadArray(__spreadArray([], __read(this.channels), false), __read((channels !== null && channels !== void 0 ? channels : [])), false)));
7736+
this.groups = Array.from(new Set(__spreadArray(__spreadArray([], __read(this.groups), false), __read((channelGroups !== null && channelGroups !== void 0 ? channelGroups : [])), false)));
77317737
if (withPresence) {
77327738
this.channels.map(function (c) { return _this.channels.push("".concat(c, "-pnpres")); });
77337739
this.groups.map(function (g) { return _this.groups.push("".concat(g, "-pnpres")); });
@@ -8420,10 +8426,22 @@
84208426
EventEmitter.prototype.addListener = function (l, channels, groups) {
84218427
var _this = this;
84228428
channels.forEach(function (c) {
8423-
return _this._channelListenerMap[c] ? _this._channelListenerMap[c].push(l) : (_this._channelListenerMap[c] = [l]);
8429+
if (_this._channelListenerMap[c]) {
8430+
if (!_this._channelListenerMap[c].includes(l))
8431+
_this._channelListenerMap[c].push(l);
8432+
}
8433+
else {
8434+
_this._channelListenerMap[c] = [l];
8435+
}
84248436
});
84258437
groups.forEach(function (g) {
8426-
return _this._groupListenerMap[g] ? _this._groupListenerMap[g].push(l) : (_this._groupListenerMap[g] = [l]);
8438+
if (_this._groupListenerMap[g]) {
8439+
if (!_this._groupListenerMap[g].includes(l))
8440+
_this._groupListenerMap[g].push(l);
8441+
}
8442+
else {
8443+
_this._groupListenerMap[g] = [l];
8444+
}
84278445
});
84288446
};
84298447
EventEmitter.prototype.removeListener = function (listener, channels, groups) {

dist/web/pubnub.min.js

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/components/eventEmitter.js

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,10 +216,22 @@ var EventEmitter = /** @class */ (function () {
216216
EventEmitter.prototype.addListener = function (l, channels, groups) {
217217
var _this = this;
218218
channels.forEach(function (c) {
219-
return _this._channelListenerMap[c] ? _this._channelListenerMap[c].push(l) : (_this._channelListenerMap[c] = [l]);
219+
if (_this._channelListenerMap[c]) {
220+
if (!_this._channelListenerMap[c].includes(l))
221+
_this._channelListenerMap[c].push(l);
222+
}
223+
else {
224+
_this._channelListenerMap[c] = [l];
225+
}
220226
});
221227
groups.forEach(function (g) {
222-
return _this._groupListenerMap[g] ? _this._groupListenerMap[g].push(l) : (_this._groupListenerMap[g] = [l]);
228+
if (_this._groupListenerMap[g]) {
229+
if (!_this._groupListenerMap[g].includes(l))
230+
_this._groupListenerMap[g].push(l);
231+
}
232+
else {
233+
_this._groupListenerMap[g] = [l];
234+
}
223235
});
224236
};
225237
EventEmitter.prototype.removeListener = function (listener, channels, groups) {

lib/core/components/telemetry_manager.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,17 @@ var default_1 = /** @class */ (function () {
3030
return latencies;
3131
};
3232
default_1.prototype.startLatencyMeasure = function (operationType, identifier) {
33-
if (operationType === operations_1.default.PNSubscribeOperation || !identifier) {
33+
if (operationType === operations_1.default.PNSubscribeOperation ||
34+
operations_1.default.PNReceiveMessagesOperation ||
35+
!identifier) {
3436
return;
3537
}
3638
this._trackedLatencies[identifier] = Date.now();
3739
};
3840
default_1.prototype.stopLatencyMeasure = function (operationType, identifier) {
39-
if (operationType === operations_1.default.PNSubscribeOperation || !identifier) {
41+
if (operationType === operations_1.default.PNSubscribeOperation ||
42+
operations_1.default.PNReceiveMessagesOperation ||
43+
!identifier) {
4044
return;
4145
}
4246
var endpointName = this._endpointName(operationType);

lib/core/endpoints/subscriptionUtils/handshake.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,9 @@ var endpoint = {
1414
},
1515
getURL: function (_a, params) {
1616
var config = _a.config;
17-
var channelsString = params.channels ? params.channels.join(',') : ',';
18-
return "/v2/subscribe/".concat(config.subscribeKey, "/").concat(utils_1.default.encodeString(channelsString), "/0");
17+
var _b = params.channels, channels = _b === void 0 ? [] : _b;
18+
var stringifiedChannels = channels.length > 0 ? channels.join(',') : ',';
19+
return "/v2/subscribe/".concat(config.subscribeKey, "/").concat(utils_1.default.encodeString(stringifiedChannels), "/0");
1920
},
2021
getRequestTimeout: function (_a) {
2122
var config = _a.config;

lib/core/endpoints/subscriptionUtils/receiveMessages.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,9 @@ var endpoint = {
2020
},
2121
getURL: function (_a, params) {
2222
var config = _a.config;
23-
var channelsString = params.channels ? params.channels.join(',') : ',';
24-
return "/v2/subscribe/".concat(config.subscribeKey, "/").concat(utils_1.default.encodeString(channelsString), "/0");
23+
var _b = params.channels, channels = _b === void 0 ? [] : _b;
24+
var stringifiedChannels = channels.length > 0 ? channels.join(',') : ',';
25+
return "/v2/subscribe/".concat(config.subscribeKey, "/").concat(utils_1.default.encodeString(stringifiedChannels), "/0");
2526
},
2627
getRequestTimeout: function (_a) {
2728
var config = _a.config;

lib/event-engine/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,8 @@ var EventEngine = /** @class */ (function () {
7878
EventEngine.prototype.subscribe = function (_a) {
7979
var _this = this;
8080
var channels = _a.channels, channelGroups = _a.channelGroups, timetoken = _a.timetoken, withPresence = _a.withPresence;
81-
this.channels = __spreadArray(__spreadArray([], __read(this.channels), false), __read((channels !== null && channels !== void 0 ? channels : [])), false);
82-
this.groups = __spreadArray(__spreadArray([], __read(this.groups), false), __read((channelGroups !== null && channelGroups !== void 0 ? channelGroups : [])), false);
81+
this.channels = Array.from(new Set(__spreadArray(__spreadArray([], __read(this.channels), false), __read((channels !== null && channels !== void 0 ? channels : [])), false)));
82+
this.groups = Array.from(new Set(__spreadArray(__spreadArray([], __read(this.groups), false), __read((channelGroups !== null && channelGroups !== void 0 ? channelGroups : [])), false)));
8383
if (withPresence) {
8484
this.channels.map(function (c) { return _this.channels.push("".concat(c, "-pnpres")); });
8585
this.groups.map(function (g) { return _this.groups.push("".concat(g, "-pnpres")); });

0 commit comments

Comments
 (0)