react-sync-board 1.4.1 → 1.4.2
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/react-sync-board.js
CHANGED
|
@@ -124,25 +124,27 @@ var m = Object.create, h = Object.defineProperty, g = Object.getOwnPropertyDescr
|
|
|
124
124
|
return e.useEffect(() => (h.current = !0, () => {
|
|
125
125
|
h.current = !1;
|
|
126
126
|
}), []), e.useEffect(() => {
|
|
127
|
-
if (!t) return
|
|
127
|
+
if (!t) return;
|
|
128
128
|
let e = () => {
|
|
129
129
|
console.log(`Disconnected from ${i}…`), h.current && (l(!1), d(!1));
|
|
130
130
|
};
|
|
131
131
|
return t.on("disconnect", e), () => {
|
|
132
132
|
t.off("disconnect", e);
|
|
133
133
|
};
|
|
134
|
-
}, [i, t]), e.useEffect(() =>
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
134
|
+
}, [i, t]), e.useEffect(() => {
|
|
135
|
+
if (t) return t.connected || t.connect(), console.log(`Try to connect to wire ${n} on channel ${i}`), _.current || (_.current = !0, te({
|
|
136
|
+
socket: t,
|
|
137
|
+
room: n,
|
|
138
|
+
onMaster: () => {
|
|
139
|
+
console.log(`Is now master on channel ${i}…`), h.current && d(!0);
|
|
140
|
+
},
|
|
141
|
+
onJoined: (e) => {
|
|
142
|
+
console.log(`Connected on channel ${i}…`), m.current = e, h.current && (p(e), l(!0));
|
|
143
|
+
}
|
|
144
|
+
})), () => {
|
|
145
|
+
m.current?.leave();
|
|
146
|
+
};
|
|
147
|
+
}, [
|
|
146
148
|
i,
|
|
147
149
|
n,
|
|
148
150
|
t
|