saloe 0.0.83 → 0.0.84
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/html.cjs.js +2 -3
- package/dist/html.es.js +3 -4
- package/package.json +1 -1
- package/src/html.js +4 -4
- package/src/listener.js +0 -12
package/dist/html.cjs.js
CHANGED
|
@@ -38,8 +38,8 @@ const stream = ({ head, body, scripts, env, status, args }) => {
|
|
|
38
38
|
];
|
|
39
39
|
return worker.stream({ callbacks, headers, status });
|
|
40
40
|
};
|
|
41
|
-
const awaitHtml = async ({ pending, success, error }) => {
|
|
42
|
-
|
|
41
|
+
const awaitHtml = async ({ id, pending, success, error }) => {
|
|
42
|
+
id = id ?? Math.floor(Math.random() * 1e9);
|
|
43
43
|
const pendingId = `pending_${id}`;
|
|
44
44
|
const pendingRoutePathname = `/~/components/${pendingId}`;
|
|
45
45
|
const route = async () => {
|
|
@@ -57,7 +57,6 @@ const awaitHtml = async ({ pending, success, error }) => {
|
|
|
57
57
|
],
|
|
58
58
|
headers
|
|
59
59
|
});
|
|
60
|
-
router.removeRoute({ pathname: pendingRoutePathname });
|
|
61
60
|
return streamResult;
|
|
62
61
|
};
|
|
63
62
|
router.addRoute({
|
package/dist/html.es.js
CHANGED
|
@@ -3,7 +3,7 @@ var __defProp = Object.defineProperty;
|
|
|
3
3
|
var __template = (cooked, raw) => __freeze(__defProp(cooked, "raw", { value: __freeze(raw || cooked.slice()) }));
|
|
4
4
|
var _a;
|
|
5
5
|
import { stream as stream$1 } from "./worker.es.js";
|
|
6
|
-
import { addRoute
|
|
6
|
+
import { addRoute } from "./router.es.js";
|
|
7
7
|
import { getScope, getEnv } from "./util.es.js";
|
|
8
8
|
const html = (s, ...args) => {
|
|
9
9
|
var _a2;
|
|
@@ -36,8 +36,8 @@ const stream = ({ head, body, scripts, env, status, args }) => {
|
|
|
36
36
|
];
|
|
37
37
|
return stream$1({ callbacks, headers, status });
|
|
38
38
|
};
|
|
39
|
-
const awaitHtml = async ({ pending, success, error }) => {
|
|
40
|
-
|
|
39
|
+
const awaitHtml = async ({ id, pending, success, error }) => {
|
|
40
|
+
id = id ?? Math.floor(Math.random() * 1e9);
|
|
41
41
|
const pendingId = `pending_${id}`;
|
|
42
42
|
const pendingRoutePathname = `/~/components/${pendingId}`;
|
|
43
43
|
const route = async () => {
|
|
@@ -55,7 +55,6 @@ const awaitHtml = async ({ pending, success, error }) => {
|
|
|
55
55
|
],
|
|
56
56
|
headers
|
|
57
57
|
});
|
|
58
|
-
removeRoute({ pathname: pendingRoutePathname });
|
|
59
58
|
return streamResult;
|
|
60
59
|
};
|
|
61
60
|
addRoute({
|
package/package.json
CHANGED
package/src/html.js
CHANGED
|
@@ -37,9 +37,9 @@ const stream = ({ head, body, scripts, env, status, args }) => {
|
|
|
37
37
|
return streamAsWorker({ callbacks, headers, status })
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
const awaitHtml = async ({ pending, success, error }) => {
|
|
41
|
-
|
|
42
|
-
|
|
40
|
+
const awaitHtml = async ({ id, pending, success, error }) => {
|
|
41
|
+
id = id ?? Math.floor(Math.random() * 1_000_000_000)
|
|
42
|
+
|
|
43
43
|
const pendingId = `pending_${id}`
|
|
44
44
|
const pendingRoutePathname = `/~/components/${pendingId}`
|
|
45
45
|
|
|
@@ -64,7 +64,7 @@ const awaitHtml = async ({ pending, success, error }) => {
|
|
|
64
64
|
headers,
|
|
65
65
|
})
|
|
66
66
|
|
|
67
|
-
removeRoute({ pathname: pendingRoutePathname })
|
|
67
|
+
// removeRoute({ pathname: pendingRoutePathname })
|
|
68
68
|
|
|
69
69
|
return streamResult
|
|
70
70
|
}
|
package/src/listener.js
CHANGED
|
@@ -16,24 +16,12 @@ const listener = ({
|
|
|
16
16
|
'invalid',
|
|
17
17
|
]
|
|
18
18
|
|
|
19
|
-
// const addListener = ({ srcElement, eventName, listeners }) => {
|
|
20
|
-
// srcElement?.addEventListener(eventName, (e) => {
|
|
21
|
-
// executeListeners({ e, srcElement, listeners })
|
|
22
|
-
// })
|
|
23
|
-
// }
|
|
24
|
-
|
|
25
19
|
const addListener = ({ srcElement, eventName, listeners, afterExecuteListeners }) => {
|
|
26
20
|
srcElement?.addEventListener(eventName, (e) => {
|
|
27
21
|
executeListeners({ e, srcElement, listeners, afterExecuteListeners })
|
|
28
22
|
})
|
|
29
23
|
}
|
|
30
24
|
|
|
31
|
-
// const executeListeners = async ({ e, srcElement, listeners }) => {
|
|
32
|
-
// listeners?.forEach((listener) => {
|
|
33
|
-
// if (listener) listener({ e, srcElement })
|
|
34
|
-
// })
|
|
35
|
-
// }
|
|
36
|
-
|
|
37
25
|
const executeListeners = async ({ e, srcElement, listeners, afterExecuteListeners }) => {
|
|
38
26
|
await Promise.all(
|
|
39
27
|
(listeners ?? []).map((listener) => {
|