@qwik.dev/utils 2.0.0-beta.43 → 2.0.0-beta.47
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/lib/index.qwik.mjs +9 -6
- package/lib/q-manifest.json +3 -3
- package/package.json +3 -3
package/lib/index.qwik.mjs
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
/** Smallest allowed poll interval, so a `0` or negative `expires` can't spin the event loop. */
|
|
1
|
+
import { _capturesObj, inlinedQrl, useVisibleTaskQrl } from "@qwik.dev/core";
|
|
2
|
+
/** Smallest allowed poll interval, so a `0` or negative `expires` can't spin the event loop. */
|
|
3
|
+
var MIN_EXPIRES_MS = 5;
|
|
3
4
|
/**
|
|
4
5
|
* Poll a computed/async signal: invalidate it every `expires` milliseconds so it recomputes. The
|
|
5
6
|
* signal is returned so it can be wrapped inline.
|
|
@@ -11,11 +12,13 @@ import { _captures, inlinedQrl, useVisibleTaskQrl } from "@qwik.dev/core";
|
|
|
11
12
|
* Multiple components may call `usePoll` on the same signal; the redundant timers are harmless.
|
|
12
13
|
*
|
|
13
14
|
* @public
|
|
14
|
-
*/
|
|
15
|
+
*/
|
|
16
|
+
var usePoll = (signal, expires) => {
|
|
15
17
|
useVisibleTaskQrl(/*#__PURE__*/ inlinedQrl(({ track, cleanup }) => {
|
|
16
|
-
|
|
17
|
-
const
|
|
18
|
-
track(() =>
|
|
18
|
+
let expires = _capturesObj._[0], signal = _capturesObj._[1];
|
|
19
|
+
const signalInternal = signal;
|
|
20
|
+
const pending = track(() => signalInternal.pending);
|
|
21
|
+
track(() => signalInternal.error);
|
|
19
22
|
if (!pending) {
|
|
20
23
|
const intervalId = setInterval(() => signal.invalidate(), Math.max(expires, MIN_EXPIRES_MS));
|
|
21
24
|
cleanup(() => clearInterval(intervalId));
|
package/lib/q-manifest.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": "1",
|
|
3
|
-
"manifestHash": "
|
|
3
|
+
"manifestHash": "orl9hr",
|
|
4
4
|
"options": {
|
|
5
5
|
"target": "lib",
|
|
6
6
|
"buildMode": "development",
|
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
"mapping": {},
|
|
14
14
|
"bundles": {
|
|
15
15
|
"../index.qwik.mjs": {
|
|
16
|
-
"size":
|
|
17
|
-
"total":
|
|
16
|
+
"size": 1324,
|
|
17
|
+
"total": 1324,
|
|
18
18
|
"origins": [
|
|
19
19
|
"src/index.qwik.ts",
|
|
20
20
|
"src/use-poll.ts"
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@qwik.dev/utils",
|
|
3
3
|
"description": "Useful but less common utilities for Qwik applications",
|
|
4
|
-
"version": "2.0.0-beta.
|
|
4
|
+
"version": "2.0.0-beta.47",
|
|
5
5
|
"bugs": "https://github.com/QwikDev/qwik/issues",
|
|
6
6
|
"devDependencies": {
|
|
7
7
|
"typescript": "5.9.3",
|
|
8
8
|
"vite": "8.2.1",
|
|
9
|
-
"@qwik.dev/core": "2.0.0-beta.
|
|
9
|
+
"@qwik.dev/core": "2.0.0-beta.47"
|
|
10
10
|
},
|
|
11
11
|
"engines": {
|
|
12
12
|
"node": "^18.17.0 || ^20.3.0 || >=21.0.0"
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"license": "MIT",
|
|
25
25
|
"main": "./lib/index.qwik.mjs",
|
|
26
26
|
"peerDependencies": {
|
|
27
|
-
"@qwik.dev/core": "2.0.0-beta.
|
|
27
|
+
"@qwik.dev/core": "2.0.0-beta.47"
|
|
28
28
|
},
|
|
29
29
|
"publishConfig": {
|
|
30
30
|
"access": "public"
|