soonjs 0.0.19 → 0.0.20
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/index.d.ts +1 -0
- package/dist/index.js +19 -16
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -54479,41 +54479,44 @@ function Aue({
|
|
|
54479
54479
|
const n = new SE((i) => {
|
|
54480
54480
|
let s;
|
|
54481
54481
|
e > 0 && (s = setInterval(() => {
|
|
54482
|
-
|
|
54482
|
+
o.closed ? clearInterval(s) : i.next({ event: "ping", message: `: ping
|
|
54483
54483
|
|
|
54484
54484
|
` });
|
|
54485
54485
|
}, e));
|
|
54486
|
-
const a = {
|
|
54487
|
-
send(
|
|
54486
|
+
const a = [], o = {
|
|
54487
|
+
send(u) {
|
|
54488
54488
|
try {
|
|
54489
54489
|
i.next({
|
|
54490
|
-
...
|
|
54491
|
-
message: `${
|
|
54492
|
-
` : ""}data: ${typeof
|
|
54490
|
+
...u,
|
|
54491
|
+
message: `${u.event ? `event: ${u.event}
|
|
54492
|
+
` : ""}data: ${typeof u.data == "string" ? u.data : JSON.stringify(u.data)}
|
|
54493
54493
|
|
|
54494
54494
|
`
|
|
54495
54495
|
});
|
|
54496
|
-
} catch (
|
|
54497
|
-
|
|
54496
|
+
} catch (l) {
|
|
54497
|
+
o.error(l.message);
|
|
54498
54498
|
}
|
|
54499
54499
|
},
|
|
54500
|
-
error(
|
|
54501
|
-
i.next({ event: "error", data:
|
|
54502
|
-
data: ${
|
|
54500
|
+
error(u) {
|
|
54501
|
+
i.next({ event: "error", data: u, message: `event: error
|
|
54502
|
+
data: ${u}
|
|
54503
54503
|
|
|
54504
|
-
` }), i.complete(),
|
|
54504
|
+
` }), i.complete(), o.closed = !0, a.forEach((l) => l == null ? void 0 : l());
|
|
54505
54505
|
},
|
|
54506
54506
|
close() {
|
|
54507
54507
|
i.next({ event: "close", message: `event: close
|
|
54508
54508
|
data:
|
|
54509
54509
|
|
|
54510
|
-
` }), i.complete(),
|
|
54510
|
+
` }), i.complete(), o.closed = !0, s && clearInterval(s), a.forEach((u) => u == null ? void 0 : u());
|
|
54511
54511
|
},
|
|
54512
|
-
closed: !1
|
|
54512
|
+
closed: !1,
|
|
54513
|
+
onClosed(u) {
|
|
54514
|
+
a.push(u);
|
|
54515
|
+
}
|
|
54513
54516
|
};
|
|
54514
54517
|
r = () => {
|
|
54515
|
-
|
|
54516
|
-
}, t(
|
|
54518
|
+
o.closed || o.close();
|
|
54519
|
+
}, t(o);
|
|
54517
54520
|
});
|
|
54518
54521
|
return n.streamClose = () => r == null ? void 0 : r(), n;
|
|
54519
54522
|
}
|