Skip to content

Commit

Permalink
lib/dist
Browse files Browse the repository at this point in the history
  • Loading branch information
mohitpubnub committed Feb 5, 2024
1 parent 018cccb commit 419bdb5
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 9 deletions.
36 changes: 32 additions & 4 deletions dist/web/pubnub.js
Original file line number Diff line number Diff line change
Expand Up @@ -8474,15 +8474,15 @@

var SubscriptionSet = /** @class */ (function () {
function SubscriptionSet(_a) {
var channels = _a.channels, channelGroups = _a.channelGroups, subscriptionOptions = _a.subscriptionOptions, eventEmitter = _a.eventEmitter, pubnub = _a.pubnub;
var _b = _a.channels, channels = _b === void 0 ? [] : _b, _c = _a.channelGroups, channelGroups = _c === void 0 ? [] : _c, subscriptionOptions = _a.subscriptionOptions, eventEmitter = _a.eventEmitter, pubnub = _a.pubnub;
this.channelNames = [];
this.groupNames = [];
this.channelNames = __spreadArray(__spreadArray([], __read(this.channelNames), false), __read(channels), false);
this.groupNames = __spreadArray(__spreadArray([], __read(this.groupNames), false), __read(channelGroups), false);
this.options = subscriptionOptions;
this.eventEmitter = eventEmitter;
this.pubnub = pubnub;
this.subscriptions = [
this._subscriptions = [
new Subscription({
channels: this.channelNames,
channelGroups: this.groupNames,
Expand All @@ -8506,7 +8506,7 @@
this.eventEmitter.removeListener(listener, this.channelNames, this.groupNames);
};
SubscriptionSet.prototype.addSubscription = function (subscription) {
this.subscriptions.push(subscription);
this._subscriptions.push(subscription);
this.channelNames = __spreadArray(__spreadArray([], __read(this.channelNames), false), __read(subscription.channels), false);
this.groupNames = __spreadArray(__spreadArray([], __read(this.groupNames), false), __read(subscription.channelGroups), false);
};
Expand All @@ -8515,7 +8515,19 @@
var groupsToRemove = subscription.channelGroups;
this.channelNames = this.channelNames.filter(function (c) { return !channelsToRemove.includes(c); });
this.groupNames = this.groupNames.filter(function (cg) { return !groupsToRemove.includes(cg); });
this.subscriptions = this.subscriptions.filter(function (s) { return s !== subscription; });
this._subscriptions = this._subscriptions.filter(function (s) { return s !== subscription; });
};
SubscriptionSet.prototype.addSubscriptionSet = function (subscriptionSet) {
this._subscriptions = __spreadArray(__spreadArray([], __read(this._subscriptions), false), __read(subscriptionSet.subscriptions), false);
this.channelNames = __spreadArray(__spreadArray([], __read(this.channelNames), false), __read(subscriptionSet.channels), false);
this.groupNames = __spreadArray(__spreadArray([], __read(this.groupNames), false), __read(subscriptionSet.channelGroups), false);
};
SubscriptionSet.prototype.removeSubscriptionSet = function (subscriptionSet) {
var channelsToRemove = subscriptionSet.channels;
var groupsToRemove = subscriptionSet.channelGroups;
this.channelNames = this.channelNames.filter(function (c) { return !channelsToRemove.includes(c); });
this.groupNames = this.groupNames.filter(function (cg) { return !groupsToRemove.includes(cg); });
this._subscriptions = this._subscriptions.filter(function (s) { return !subscriptionSet.subscriptions.includes(s); });
};
Object.defineProperty(SubscriptionSet.prototype, "channels", {
get: function () {
Expand All @@ -8531,6 +8543,13 @@
enumerable: false,
configurable: true
});
Object.defineProperty(SubscriptionSet.prototype, "subscriptions", {
get: function () {
return this._subscriptions.slice(0);
},
enumerable: false,
configurable: true
});
return SubscriptionSet;
}());

Expand Down Expand Up @@ -8876,6 +8895,15 @@
this.channelGroup = function (name) { return new ChannelGroup(name, _this._eventEmitter, _this); };
this.channelMetadata = function (id) { return new ChannelMetadata(id, _this._eventEmitter, _this); };
this.userMetadata = function (id) { return new UserMetadata(id, _this._eventEmitter, _this); };
this.subscriptionSet = function (args) {
return new SubscriptionSet({
channels: args.channels,
channelGroups: args.channelGroups,
subscriptionOptions: args.subscriptionOptions,
eventEmitter: _this._eventEmitter,
pubnub: _this,
});
};
// Objects API v2
this.objects = {
getAllUUIDMetadata: endpointCreator.bind(this, modules, endpoint$e),
Expand Down
2 changes: 1 addition & 1 deletion dist/web/pubnub.min.js

Large diffs are not rendered by default.

10 changes: 10 additions & 0 deletions lib/core/pubnub-common.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ var Channel_1 = require("../entities/Channel");
var ChannelGroup_1 = require("../entities/ChannelGroup");
var ChannelMetadata_1 = require("../entities/ChannelMetadata");
var UserMetadata_1 = require("../entities/UserMetadata");
var SubscriptionSet_1 = require("../entities/SubscriptionSet");
var default_1 = /** @class */ (function () {
function default_1(setup) {
var _this = this;
Expand Down Expand Up @@ -368,6 +369,15 @@ var default_1 = /** @class */ (function () {
this.channelGroup = function (name) { return new ChannelGroup_1.ChannelGroup(name, _this._eventEmitter, _this); };
this.channelMetadata = function (id) { return new ChannelMetadata_1.ChannelMetadata(id, _this._eventEmitter, _this); };
this.userMetadata = function (id) { return new UserMetadata_1.UserMetadata(id, _this._eventEmitter, _this); };
this.subscriptionSet = function (args) {
return new SubscriptionSet_1.SubscriptionSet({
channels: args.channels,
channelGroups: args.channelGroups,
subscriptionOptions: args.subscriptionOptions,
eventEmitter: _this._eventEmitter,
pubnub: _this,
});
};
// Objects API v2
this.objects = {
getAllUUIDMetadata: endpoint_1.default.bind(this, modules, get_all_1.default),
Expand Down
27 changes: 23 additions & 4 deletions lib/entities/SubscriptionSet.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,15 @@ exports.SubscriptionSet = void 0;
var Subscription_1 = require("./Subscription");
var SubscriptionSet = /** @class */ (function () {
function SubscriptionSet(_a) {
var channels = _a.channels, channelGroups = _a.channelGroups, subscriptionOptions = _a.subscriptionOptions, eventEmitter = _a.eventEmitter, pubnub = _a.pubnub;
var _b = _a.channels, channels = _b === void 0 ? [] : _b, _c = _a.channelGroups, channelGroups = _c === void 0 ? [] : _c, subscriptionOptions = _a.subscriptionOptions, eventEmitter = _a.eventEmitter, pubnub = _a.pubnub;
this.channelNames = [];
this.groupNames = [];
this.channelNames = __spreadArray(__spreadArray([], __read(this.channelNames), false), __read(channels), false);
this.groupNames = __spreadArray(__spreadArray([], __read(this.groupNames), false), __read(channelGroups), false);
this.options = subscriptionOptions;
this.eventEmitter = eventEmitter;
this.pubnub = pubnub;
this.subscriptions = [
this._subscriptions = [
new Subscription_1.Subscription({
channels: this.channelNames,
channelGroups: this.groupNames,
Expand All @@ -72,7 +72,7 @@ var SubscriptionSet = /** @class */ (function () {
this.eventEmitter.removeListener(listener, this.channelNames, this.groupNames);
};
SubscriptionSet.prototype.addSubscription = function (subscription) {
this.subscriptions.push(subscription);
this._subscriptions.push(subscription);
this.channelNames = __spreadArray(__spreadArray([], __read(this.channelNames), false), __read(subscription.channels), false);
this.groupNames = __spreadArray(__spreadArray([], __read(this.groupNames), false), __read(subscription.channelGroups), false);
};
Expand All @@ -81,7 +81,19 @@ var SubscriptionSet = /** @class */ (function () {
var groupsToRemove = subscription.channelGroups;
this.channelNames = this.channelNames.filter(function (c) { return !channelsToRemove.includes(c); });
this.groupNames = this.groupNames.filter(function (cg) { return !groupsToRemove.includes(cg); });
this.subscriptions = this.subscriptions.filter(function (s) { return s !== subscription; });
this._subscriptions = this._subscriptions.filter(function (s) { return s !== subscription; });
};
SubscriptionSet.prototype.addSubscriptionSet = function (subscriptionSet) {
this._subscriptions = __spreadArray(__spreadArray([], __read(this._subscriptions), false), __read(subscriptionSet.subscriptions), false);
this.channelNames = __spreadArray(__spreadArray([], __read(this.channelNames), false), __read(subscriptionSet.channels), false);
this.groupNames = __spreadArray(__spreadArray([], __read(this.groupNames), false), __read(subscriptionSet.channelGroups), false);
};
SubscriptionSet.prototype.removeSubscriptionSet = function (subscriptionSet) {
var channelsToRemove = subscriptionSet.channels;
var groupsToRemove = subscriptionSet.channelGroups;
this.channelNames = this.channelNames.filter(function (c) { return !channelsToRemove.includes(c); });
this.groupNames = this.groupNames.filter(function (cg) { return !groupsToRemove.includes(cg); });
this._subscriptions = this._subscriptions.filter(function (s) { return !subscriptionSet.subscriptions.includes(s); });
};
Object.defineProperty(SubscriptionSet.prototype, "channels", {
get: function () {
Expand All @@ -97,6 +109,13 @@ var SubscriptionSet = /** @class */ (function () {
enumerable: false,
configurable: true
});
Object.defineProperty(SubscriptionSet.prototype, "subscriptions", {
get: function () {
return this._subscriptions.slice(0);
},
enumerable: false,
configurable: true
});
return SubscriptionSet;
}());
exports.SubscriptionSet = SubscriptionSet;

0 comments on commit 419bdb5

Please sign in to comment.