@base44-preview/sdk 0.8.29-pr.176.30c5ce1 → 0.8.29-pr.176.65ba61b
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/utils/socket-utils.js +11 -0
- package/package.json +1 -1
|
@@ -69,6 +69,7 @@ export function RoomsSocket({ config }) {
|
|
|
69
69
|
disconnect();
|
|
70
70
|
}
|
|
71
71
|
function disconnect() {
|
|
72
|
+
clearPendingRoomLeaves();
|
|
72
73
|
if (socket) {
|
|
73
74
|
socket.disconnect();
|
|
74
75
|
}
|
|
@@ -104,6 +105,16 @@ export function RoomsSocket({ config }) {
|
|
|
104
105
|
clearTimeout(pendingLeave);
|
|
105
106
|
delete pendingRoomLeaves[room];
|
|
106
107
|
}
|
|
108
|
+
function clearPendingRoomLeaves() {
|
|
109
|
+
Object.keys(pendingRoomLeaves).forEach((room) => {
|
|
110
|
+
var _a, _b;
|
|
111
|
+
clearTimeout(pendingRoomLeaves[room]);
|
|
112
|
+
delete pendingRoomLeaves[room];
|
|
113
|
+
if (((_b = (_a = roomsToListeners[room]) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0) === 0) {
|
|
114
|
+
delete roomsToListeners[room];
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
}
|
|
107
118
|
function scheduleRoomLeave(room) {
|
|
108
119
|
cancelPendingRoomLeave(room);
|
|
109
120
|
pendingRoomLeaves[room] = setTimeout(() => {
|