@folklore/socket 0.4.23 → 0.4.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs.js +12 -5
- package/dist/es.js +12 -5
- package/package.json +2 -2
package/dist/cjs.js
CHANGED
|
@@ -21,6 +21,7 @@ class PubNubSocket extends EventEmitter {
|
|
|
21
21
|
publishKey: null,
|
|
22
22
|
subscribeKey: null,
|
|
23
23
|
secretKey: null,
|
|
24
|
+
withPresence: false,
|
|
24
25
|
...opts
|
|
25
26
|
};
|
|
26
27
|
this.onReady = this.onReady.bind(this);
|
|
@@ -144,13 +145,15 @@ class PubNubSocket extends EventEmitter {
|
|
|
144
145
|
return;
|
|
145
146
|
}
|
|
146
147
|
const {
|
|
147
|
-
subscriptionOptions
|
|
148
|
+
subscriptionOptions,
|
|
149
|
+
withPresence
|
|
148
150
|
} = this.options;
|
|
149
151
|
this.shouldStart = false;
|
|
150
152
|
this.starting = true;
|
|
151
153
|
this.pubnub.subscribe({
|
|
152
154
|
channels: this.channels,
|
|
153
|
-
subscriptionOptions
|
|
155
|
+
subscriptionOptions,
|
|
156
|
+
withPresence
|
|
154
157
|
});
|
|
155
158
|
this.emit('start');
|
|
156
159
|
}
|
|
@@ -824,11 +827,15 @@ function SocketContainer(_ref) {
|
|
|
824
827
|
}, [updateChannels]);
|
|
825
828
|
const removeToChannelsCount = React.useCallback(newChannels => {
|
|
826
829
|
channelsCountRef.current = newChannels.reduce((map, channel) => {
|
|
827
|
-
const
|
|
830
|
+
const {
|
|
831
|
+
[channel]: currentCount = 0,
|
|
832
|
+
...otherCount
|
|
833
|
+
} = map;
|
|
834
|
+
const newCount = (currentCount || 0) - 1;
|
|
828
835
|
return newCount > 0 ? {
|
|
829
|
-
...
|
|
836
|
+
...otherCount,
|
|
830
837
|
[channel]: newCount
|
|
831
|
-
} :
|
|
838
|
+
} : otherCount;
|
|
832
839
|
}, channelsCountRef.current);
|
|
833
840
|
updateChannels(Object.keys(channelsCountRef.current));
|
|
834
841
|
}, [updateChannels]);
|
package/dist/es.js
CHANGED
|
@@ -17,6 +17,7 @@ class PubNubSocket extends EventEmitter {
|
|
|
17
17
|
publishKey: null,
|
|
18
18
|
subscribeKey: null,
|
|
19
19
|
secretKey: null,
|
|
20
|
+
withPresence: false,
|
|
20
21
|
...opts
|
|
21
22
|
};
|
|
22
23
|
this.onReady = this.onReady.bind(this);
|
|
@@ -140,13 +141,15 @@ class PubNubSocket extends EventEmitter {
|
|
|
140
141
|
return;
|
|
141
142
|
}
|
|
142
143
|
const {
|
|
143
|
-
subscriptionOptions
|
|
144
|
+
subscriptionOptions,
|
|
145
|
+
withPresence
|
|
144
146
|
} = this.options;
|
|
145
147
|
this.shouldStart = false;
|
|
146
148
|
this.starting = true;
|
|
147
149
|
this.pubnub.subscribe({
|
|
148
150
|
channels: this.channels,
|
|
149
|
-
subscriptionOptions
|
|
151
|
+
subscriptionOptions,
|
|
152
|
+
withPresence
|
|
150
153
|
});
|
|
151
154
|
this.emit('start');
|
|
152
155
|
}
|
|
@@ -820,11 +823,15 @@ function SocketContainer(_ref) {
|
|
|
820
823
|
}, [updateChannels]);
|
|
821
824
|
const removeToChannelsCount = useCallback(newChannels => {
|
|
822
825
|
channelsCountRef.current = newChannels.reduce((map, channel) => {
|
|
823
|
-
const
|
|
826
|
+
const {
|
|
827
|
+
[channel]: currentCount = 0,
|
|
828
|
+
...otherCount
|
|
829
|
+
} = map;
|
|
830
|
+
const newCount = (currentCount || 0) - 1;
|
|
824
831
|
return newCount > 0 ? {
|
|
825
|
-
...
|
|
832
|
+
...otherCount,
|
|
826
833
|
[channel]: newCount
|
|
827
|
-
} :
|
|
834
|
+
} : otherCount;
|
|
828
835
|
}, channelsCountRef.current);
|
|
829
836
|
updateChannels(Object.keys(channelsCountRef.current));
|
|
830
837
|
}, [updateChannels]);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@folklore/socket",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.25",
|
|
4
4
|
"description": "Socket utilities",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"javascript",
|
|
@@ -56,5 +56,5 @@
|
|
|
56
56
|
"react": "^16.8.0 || ^17.0.0 || ^18.0.0",
|
|
57
57
|
"react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0"
|
|
58
58
|
},
|
|
59
|
-
"gitHead": "
|
|
59
|
+
"gitHead": "5aef43ea2ccd8a24ce2f64f6a47b53262c58e586"
|
|
60
60
|
}
|