|
3948 | 3948 | return base.PubNubFile;
|
3949 | 3949 | },
|
3950 | 3950 | get version() {
|
3951 |
| - return '8.3.0'; |
| 3951 | + return '8.3.1'; |
3952 | 3952 | },
|
3953 | 3953 | getVersion() {
|
3954 | 3954 | return this.version;
|
|
6403 | 6403 | * @param event - Received real-time event.
|
6404 | 6404 | */
|
6405 | 6405 | emitEvent(event) {
|
| 6406 | + var _a; |
6406 | 6407 | if (event.type === PubNubEventType.Message) {
|
6407 | 6408 | this.listenerManager.announceMessage(event.data);
|
6408 | 6409 | this.announce('message', event.data, event.data.channel, event.data.subscription);
|
|
6413 | 6414 | }
|
6414 | 6415 | else if (event.type === PubNubEventType.Presence) {
|
6415 | 6416 | this.listenerManager.announcePresence(event.data);
|
6416 |
| - this.announce('presence', event.data, event.data.channel, event.data.subscription); |
| 6417 | + this.announce('presence', event.data, (_a = event.data.subscription) !== null && _a !== void 0 ? _a : event.data.channel, event.data.subscription); |
6417 | 6418 | }
|
6418 | 6419 | else if (event.type === PubNubEventType.AppContext) {
|
6419 | 6420 | const { data: objectEvent } = event;
|
|
9963 | 9964 | * types of events.
|
9964 | 9965 | */
|
9965 | 9966 | addListener(listener) {
|
9966 |
| - this.eventEmitter.addListener(listener, this.channelNames.filter((c) => !c.endsWith('-pnpres')), this.groupNames.filter((cg) => !cg.endsWith('-pnpres'))); |
| 9967 | + this.eventEmitter.addListener(listener, this.channelNames, this.groupNames); |
9967 | 9968 | }
|
9968 | 9969 | /**
|
9969 | 9970 | * Remove events handler.
|
|
10065 | 10066 | this.subscriptionList.push(subscription);
|
10066 | 10067 | });
|
10067 | 10068 | this.listener = {};
|
10068 |
| - eventEmitter.addListener(this.listener, this.channelNames.filter((c) => !c.endsWith('-pnpres')), this.groupNames.filter((cg) => !cg.endsWith('-pnpres'))); |
| 10069 | + eventEmitter.addListener(this.listener, this.channelNames, this.groupNames); |
10069 | 10070 | }
|
10070 | 10071 | /**
|
10071 | 10072 | * Add additional entity's subscription to the subscription set.
|
|
10187 | 10188 | this.pubnub = pubnub;
|
10188 | 10189 | this.eventEmitter = eventEmitter;
|
10189 | 10190 | this.listener = {};
|
10190 |
| - eventEmitter.addListener(this.listener, this.channelNames.filter((c) => !c.endsWith('-pnpres')), this.groupNames.filter((cg) => !cg.endsWith('-pnpres'))); |
| 10191 | + eventEmitter.addListener(this.listener, this.channelNames, this.groupNames); |
10191 | 10192 | }
|
10192 | 10193 | /**
|
10193 | 10194 | * Merge entities' subscription objects into subscription set.
|
|
10283 | 10284 | */
|
10284 | 10285 | subscription(subscriptionOptions) {
|
10285 | 10286 | {
|
| 10287 | + const channelGroups = [this.name]; |
| 10288 | + if ((subscriptionOptions === null || subscriptionOptions === void 0 ? void 0 : subscriptionOptions.receivePresenceEvents) && !this.name.endsWith('-pnpres')) |
| 10289 | + channelGroups.push(`${this.name}-pnpres`); |
10286 | 10290 | return new Subscription({
|
10287 | 10291 | channels: [],
|
10288 |
| - channelGroups: (subscriptionOptions === null || subscriptionOptions === void 0 ? void 0 : subscriptionOptions.receivePresenceEvents) ? [this.name, `${this.name}-pnpres`] : [this.name], |
| 10292 | + channelGroups, |
10289 | 10293 | subscriptionOptions: subscriptionOptions,
|
10290 | 10294 | eventEmitter: this.eventEmitter,
|
10291 | 10295 | pubnub: this.pubnub,
|
|
10370 | 10374 | */
|
10371 | 10375 | subscription(subscriptionOptions) {
|
10372 | 10376 | {
|
| 10377 | + const channels = [this.name]; |
| 10378 | + if ((subscriptionOptions === null || subscriptionOptions === void 0 ? void 0 : subscriptionOptions.receivePresenceEvents) && !this.name.endsWith('-pnpres')) |
| 10379 | + channels.push(`${this.name}-pnpres`); |
10373 | 10380 | return new Subscription({
|
10374 |
| - channels: (subscriptionOptions === null || subscriptionOptions === void 0 ? void 0 : subscriptionOptions.receivePresenceEvents) ? [this.name, `${this.name}-pnpres`] : [this.name], |
| 10381 | + channels, |
10375 | 10382 | channelGroups: [],
|
10376 | 10383 | subscriptionOptions: subscriptionOptions,
|
10377 | 10384 | eventEmitter: this.eventEmitter,
|
|
0 commit comments