Skip to content

Commit

Permalink
dist/lib
Browse files Browse the repository at this point in the history
  • Loading branch information
mohitpubnub committed Feb 5, 2024
1 parent 7a7d1e7 commit f735cf2
Show file tree
Hide file tree
Showing 7 changed files with 57 additions and 21 deletions.
38 changes: 28 additions & 10 deletions dist/web/pubnub.js
Original file line number Diff line number Diff line change
Expand Up @@ -2565,13 +2565,17 @@
return latencies;
};
default_1.prototype.startLatencyMeasure = function (operationType, identifier) {
if (operationType === OPERATIONS.PNSubscribeOperation || !identifier) {
if (operationType === OPERATIONS.PNSubscribeOperation ||
OPERATIONS.PNReceiveMessagesOperation ||
!identifier) {
return;
}
this._trackedLatencies[identifier] = Date.now();
};
default_1.prototype.stopLatencyMeasure = function (operationType, identifier) {
if (operationType === OPERATIONS.PNSubscribeOperation || !identifier) {
if (operationType === OPERATIONS.PNSubscribeOperation ||
OPERATIONS.PNReceiveMessagesOperation ||
!identifier) {
return;
}
var endpointName = this._endpointName(operationType);
Expand Down Expand Up @@ -6731,8 +6735,9 @@
},
getURL: function (_a, params) {
var config = _a.config;
var channelsString = params.channels ? params.channels.join(',') : ',';
return "/v2/subscribe/".concat(config.subscribeKey, "/").concat(utils$5.encodeString(channelsString), "/0");
var _b = params.channels, channels = _b === void 0 ? [] : _b;
var stringifiedChannels = channels.length > 0 ? channels.join(',') : ',';
return "/v2/subscribe/".concat(config.subscribeKey, "/").concat(utils$5.encodeString(stringifiedChannels), "/0");
},
getRequestTimeout: function (_a) {
var config = _a.config;
Expand Down Expand Up @@ -6775,8 +6780,9 @@
},
getURL: function (_a, params) {
var config = _a.config;
var channelsString = params.channels ? params.channels.join(',') : ',';
return "/v2/subscribe/".concat(config.subscribeKey, "/").concat(utils$5.encodeString(channelsString), "/0");
var _b = params.channels, channels = _b === void 0 ? [] : _b;
var stringifiedChannels = channels.length > 0 ? channels.join(',') : ',';
return "/v2/subscribe/".concat(config.subscribeKey, "/").concat(utils$5.encodeString(stringifiedChannels), "/0");
},
getRequestTimeout: function (_a) {
var config = _a.config;
Expand Down Expand Up @@ -7726,8 +7732,8 @@
EventEngine.prototype.subscribe = function (_a) {
var _this = this;
var channels = _a.channels, channelGroups = _a.channelGroups, timetoken = _a.timetoken, withPresence = _a.withPresence;
this.channels = __spreadArray(__spreadArray([], __read(this.channels), false), __read((channels !== null && channels !== void 0 ? channels : [])), false);
this.groups = __spreadArray(__spreadArray([], __read(this.groups), false), __read((channelGroups !== null && channelGroups !== void 0 ? channelGroups : [])), false);
this.channels = Array.from(new Set(__spreadArray(__spreadArray([], __read(this.channels), false), __read((channels !== null && channels !== void 0 ? channels : [])), false)));
this.groups = Array.from(new Set(__spreadArray(__spreadArray([], __read(this.groups), false), __read((channelGroups !== null && channelGroups !== void 0 ? channelGroups : [])), false)));
if (withPresence) {
this.channels.map(function (c) { return _this.channels.push("".concat(c, "-pnpres")); });
this.groups.map(function (g) { return _this.groups.push("".concat(g, "-pnpres")); });
Expand Down Expand Up @@ -8420,10 +8426,22 @@
EventEmitter.prototype.addListener = function (l, channels, groups) {
var _this = this;
channels.forEach(function (c) {
return _this._channelListenerMap[c] ? _this._channelListenerMap[c].push(l) : (_this._channelListenerMap[c] = [l]);
if (_this._channelListenerMap[c]) {
if (!_this._channelListenerMap[c].includes(l))
_this._channelListenerMap[c].push(l);
}
else {
_this._channelListenerMap[c] = [l];
}
});
groups.forEach(function (g) {
return _this._groupListenerMap[g] ? _this._groupListenerMap[g].push(l) : (_this._groupListenerMap[g] = [l]);
if (_this._groupListenerMap[g]) {
if (!_this._groupListenerMap[g].includes(l))
_this._groupListenerMap[g].push(l);
}
else {
_this._groupListenerMap[g] = [l];
}
});
};
EventEmitter.prototype.removeListener = function (listener, channels, groups) {
Expand Down
2 changes: 1 addition & 1 deletion dist/web/pubnub.min.js

Large diffs are not rendered by default.

16 changes: 14 additions & 2 deletions lib/core/components/eventEmitter.js
Original file line number Diff line number Diff line change
Expand Up @@ -216,10 +216,22 @@ var EventEmitter = /** @class */ (function () {
EventEmitter.prototype.addListener = function (l, channels, groups) {
var _this = this;
channels.forEach(function (c) {
return _this._channelListenerMap[c] ? _this._channelListenerMap[c].push(l) : (_this._channelListenerMap[c] = [l]);
if (_this._channelListenerMap[c]) {
if (!_this._channelListenerMap[c].includes(l))
_this._channelListenerMap[c].push(l);
}
else {
_this._channelListenerMap[c] = [l];
}
});
groups.forEach(function (g) {
return _this._groupListenerMap[g] ? _this._groupListenerMap[g].push(l) : (_this._groupListenerMap[g] = [l]);
if (_this._groupListenerMap[g]) {
if (!_this._groupListenerMap[g].includes(l))
_this._groupListenerMap[g].push(l);
}
else {
_this._groupListenerMap[g] = [l];
}
});
};
EventEmitter.prototype.removeListener = function (listener, channels, groups) {
Expand Down
8 changes: 6 additions & 2 deletions lib/core/components/telemetry_manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,17 @@ var default_1 = /** @class */ (function () {
return latencies;
};
default_1.prototype.startLatencyMeasure = function (operationType, identifier) {
if (operationType === operations_1.default.PNSubscribeOperation || !identifier) {
if (operationType === operations_1.default.PNSubscribeOperation ||
operations_1.default.PNReceiveMessagesOperation ||
!identifier) {
return;
}
this._trackedLatencies[identifier] = Date.now();
};
default_1.prototype.stopLatencyMeasure = function (operationType, identifier) {
if (operationType === operations_1.default.PNSubscribeOperation || !identifier) {
if (operationType === operations_1.default.PNSubscribeOperation ||
operations_1.default.PNReceiveMessagesOperation ||
!identifier) {
return;
}
var endpointName = this._endpointName(operationType);
Expand Down
5 changes: 3 additions & 2 deletions lib/core/endpoints/subscriptionUtils/handshake.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@ var endpoint = {
},
getURL: function (_a, params) {
var config = _a.config;
var channelsString = params.channels ? params.channels.join(',') : ',';
return "/v2/subscribe/".concat(config.subscribeKey, "/").concat(utils_1.default.encodeString(channelsString), "/0");
var _b = params.channels, channels = _b === void 0 ? [] : _b;
var stringifiedChannels = channels.length > 0 ? channels.join(',') : ',';
return "/v2/subscribe/".concat(config.subscribeKey, "/").concat(utils_1.default.encodeString(stringifiedChannels), "/0");
},
getRequestTimeout: function (_a) {
var config = _a.config;
Expand Down
5 changes: 3 additions & 2 deletions lib/core/endpoints/subscriptionUtils/receiveMessages.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ var endpoint = {
},
getURL: function (_a, params) {
var config = _a.config;
var channelsString = params.channels ? params.channels.join(',') : ',';
return "/v2/subscribe/".concat(config.subscribeKey, "/").concat(utils_1.default.encodeString(channelsString), "/0");
var _b = params.channels, channels = _b === void 0 ? [] : _b;
var stringifiedChannels = channels.length > 0 ? channels.join(',') : ',';
return "/v2/subscribe/".concat(config.subscribeKey, "/").concat(utils_1.default.encodeString(stringifiedChannels), "/0");
},
getRequestTimeout: function (_a) {
var config = _a.config;
Expand Down
4 changes: 2 additions & 2 deletions lib/event-engine/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ var EventEngine = /** @class */ (function () {
EventEngine.prototype.subscribe = function (_a) {
var _this = this;
var channels = _a.channels, channelGroups = _a.channelGroups, timetoken = _a.timetoken, withPresence = _a.withPresence;
this.channels = __spreadArray(__spreadArray([], __read(this.channels), false), __read((channels !== null && channels !== void 0 ? channels : [])), false);
this.groups = __spreadArray(__spreadArray([], __read(this.groups), false), __read((channelGroups !== null && channelGroups !== void 0 ? channelGroups : [])), false);
this.channels = Array.from(new Set(__spreadArray(__spreadArray([], __read(this.channels), false), __read((channels !== null && channels !== void 0 ? channels : [])), false)));
this.groups = Array.from(new Set(__spreadArray(__spreadArray([], __read(this.groups), false), __read((channelGroups !== null && channelGroups !== void 0 ? channelGroups : [])), false)));
if (withPresence) {
this.channels.map(function (c) { return _this.channels.push("".concat(c, "-pnpres")); });
this.groups.map(function (g) { return _this.groups.push("".concat(g, "-pnpres")); });
Expand Down

0 comments on commit f735cf2

Please sign in to comment.