solid-tiny-utils 0.0.1 → 0.1.0
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/{chunk-ZHWDHAF3.js → chunk-37DCIGY3.js} +7 -3
- package/dist/{chunk-WAZBT4BV.js → chunk-EDY67NJO.js} +1 -1
- package/dist/{chunk-7K22IJFO.js → chunk-KK2I663A.js} +1 -1
- package/dist/{chunk-PEWQLY2D.js → chunk-L5HLW5DG.js} +5 -1
- package/dist/fn/create-debounce.js +3 -3
- package/dist/fn/create-loop-exec.d.ts +2 -1
- package/dist/fn/create-loop-exec.js +3 -3
- package/dist/fn/index.js +4 -4
- package/dist/index.d.ts +1 -1
- package/dist/index.js +8 -6
- package/dist/is/index.d.ts +2 -1
- package/dist/is/index.js +5 -3
- package/dist/reactive/access.js +2 -2
- package/dist/reactive/index.js +2 -2
- package/package.json +1 -1
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
access
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-KK2I663A.js";
|
|
4
|
+
import {
|
|
5
|
+
isNumber
|
|
6
|
+
} from "./chunk-L5HLW5DG.js";
|
|
4
7
|
import {
|
|
5
8
|
createWatch
|
|
6
9
|
} from "./chunk-4L6FK7MF.js";
|
|
@@ -13,7 +16,8 @@ function createLoopExec(fn, delay) {
|
|
|
13
16
|
let timer;
|
|
14
17
|
const execFn = async () => {
|
|
15
18
|
clearTimeout(timer);
|
|
16
|
-
|
|
19
|
+
const d = access(delay);
|
|
20
|
+
if (shouldStop || !isNumber(d) || d < 0) {
|
|
17
21
|
return;
|
|
18
22
|
}
|
|
19
23
|
try {
|
|
@@ -21,7 +25,7 @@ function createLoopExec(fn, delay) {
|
|
|
21
25
|
} finally {
|
|
22
26
|
timer = setTimeout(() => {
|
|
23
27
|
execFn();
|
|
24
|
-
},
|
|
28
|
+
}, d);
|
|
25
29
|
}
|
|
26
30
|
};
|
|
27
31
|
createWatch(
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createDebounce
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-EDY67NJO.js";
|
|
4
4
|
import "../chunk-ZZNAXGNU.js";
|
|
5
|
-
import "../chunk-
|
|
6
|
-
import "../chunk-
|
|
5
|
+
import "../chunk-KK2I663A.js";
|
|
6
|
+
import "../chunk-L5HLW5DG.js";
|
|
7
7
|
import "../chunk-4L6FK7MF.js";
|
|
8
8
|
export {
|
|
9
9
|
createDebounce
|
|
@@ -7,13 +7,14 @@ import 'solid-js';
|
|
|
7
7
|
*
|
|
8
8
|
* @param fn - The asynchronous function to execute in a loop. Can return a promise or void.
|
|
9
9
|
* @param delay - The delay (in milliseconds) between each execution. Can be a number or a reactive accessor.
|
|
10
|
+
* If `false` or < 0, the loop will not execute.
|
|
10
11
|
*
|
|
11
12
|
* @remarks
|
|
12
13
|
* - The loop is automatically stopped when cleanup.
|
|
13
14
|
* - `fn`'s error will not stop scheduling.
|
|
14
15
|
* - Uses `setTimeout` for scheduling and `onCleanup` for resource management.
|
|
15
16
|
*/
|
|
16
|
-
declare function createLoopExec(fn: () => MaybePromise<void>, delay: MaybeAccessor<number>): {
|
|
17
|
+
declare function createLoopExec(fn: () => MaybePromise<void>, delay: MaybeAccessor<number | false>): {
|
|
17
18
|
stop: () => void;
|
|
18
19
|
start: () => void;
|
|
19
20
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createLoopExec
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-37DCIGY3.js";
|
|
4
4
|
import "../chunk-ZZNAXGNU.js";
|
|
5
|
-
import "../chunk-
|
|
6
|
-
import "../chunk-
|
|
5
|
+
import "../chunk-KK2I663A.js";
|
|
6
|
+
import "../chunk-L5HLW5DG.js";
|
|
7
7
|
import "../chunk-4L6FK7MF.js";
|
|
8
8
|
export {
|
|
9
9
|
createLoopExec
|
package/dist/fn/index.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import "../chunk-QKJKTJQE.js";
|
|
2
2
|
import {
|
|
3
3
|
createDebounce
|
|
4
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-EDY67NJO.js";
|
|
5
5
|
import {
|
|
6
6
|
createLoopExec
|
|
7
|
-
} from "../chunk-
|
|
7
|
+
} from "../chunk-37DCIGY3.js";
|
|
8
8
|
import "../chunk-ZZNAXGNU.js";
|
|
9
|
-
import "../chunk-
|
|
10
|
-
import "../chunk-
|
|
9
|
+
import "../chunk-KK2I663A.js";
|
|
10
|
+
import "../chunk-L5HLW5DG.js";
|
|
11
11
|
import "../chunk-4L6FK7MF.js";
|
|
12
12
|
export {
|
|
13
13
|
createDebounce,
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { createDebounce } from './fn/create-debounce.js';
|
|
2
2
|
export { createLoopExec } from './fn/create-loop-exec.js';
|
|
3
|
-
export { isArray, isFn } from './is/index.js';
|
|
3
|
+
export { isArray, isFn, isNumber } from './is/index.js';
|
|
4
4
|
export { access } from './reactive/access.js';
|
|
5
5
|
export { createWatch } from './reactive/create-watch.js';
|
|
6
6
|
export { MaybeAccessor, MaybeArray, MaybePromise } from './types/maybe.js';
|
package/dist/index.js
CHANGED
|
@@ -3,18 +3,19 @@ import "./chunk-EZML2DEC.js";
|
|
|
3
3
|
import "./chunk-QKJKTJQE.js";
|
|
4
4
|
import {
|
|
5
5
|
createDebounce
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-EDY67NJO.js";
|
|
7
7
|
import {
|
|
8
8
|
createLoopExec
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-37DCIGY3.js";
|
|
10
10
|
import "./chunk-ZZNAXGNU.js";
|
|
11
11
|
import {
|
|
12
12
|
access
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-KK2I663A.js";
|
|
14
14
|
import {
|
|
15
15
|
isArray,
|
|
16
|
-
isFn
|
|
17
|
-
|
|
16
|
+
isFn,
|
|
17
|
+
isNumber
|
|
18
|
+
} from "./chunk-L5HLW5DG.js";
|
|
18
19
|
import {
|
|
19
20
|
createWatch
|
|
20
21
|
} from "./chunk-4L6FK7MF.js";
|
|
@@ -24,5 +25,6 @@ export {
|
|
|
24
25
|
createLoopExec,
|
|
25
26
|
createWatch,
|
|
26
27
|
isArray,
|
|
27
|
-
isFn
|
|
28
|
+
isFn,
|
|
29
|
+
isNumber
|
|
28
30
|
};
|
package/dist/is/index.d.ts
CHANGED
package/dist/is/index.js
CHANGED
package/dist/reactive/access.js
CHANGED
package/dist/reactive/index.js
CHANGED