solid-tiny-utils 0.2.0 → 0.4.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.
Files changed (58) hide show
  1. package/README.md +0 -68
  2. package/dist/chunk-BGLY6NJK.js +111 -0
  3. package/dist/{chunk-WLQ64SAO.js → chunk-CSAKXWF3.js} +5 -1
  4. package/dist/{chunk-YJB637I2.js → chunk-HPKVQC7S.js} +4 -3
  5. package/dist/chunk-II6INKPZ.js +8 -0
  6. package/dist/chunk-KFWZFQMB.js +8 -0
  7. package/dist/chunk-KLRTXD4R.js +53 -0
  8. package/dist/chunk-OUAI75QC.js +55 -0
  9. package/dist/{chunk-RRYFZNKE.js → chunk-PBALVUKK.js} +1 -1
  10. package/dist/chunk-PNR5G432.js +85 -0
  11. package/dist/chunk-YXRZ2KMJ.js +0 -0
  12. package/dist/dom/css.js +5 -3
  13. package/dist/dom/index.js +5 -3
  14. package/dist/event/create-click-outside.js +8 -5
  15. package/dist/event/create-event-listener.d.ts +23 -0
  16. package/dist/event/create-event-listener.js +16 -0
  17. package/dist/event/index.d.ts +3 -0
  18. package/dist/event/index.js +17 -7
  19. package/dist/event/make-event-listener.d.ts +49 -0
  20. package/dist/event/make-event-listener.js +15 -0
  21. package/dist/fn/create-debounce.js +6 -5
  22. package/dist/fn/create-loop-exec.js +6 -5
  23. package/dist/fn/create-throttle.d.ts +6 -0
  24. package/dist/fn/create-throttle.js +14 -0
  25. package/dist/fn/index.d.ts +1 -0
  26. package/dist/fn/index.js +10 -11
  27. package/dist/index.d.ts +9 -1
  28. package/dist/index.js +50 -13
  29. package/dist/jsx/attrs.d.ts +22 -0
  30. package/dist/jsx/attrs.js +6 -0
  31. package/dist/jsx/index.d.ts +1 -0
  32. package/dist/jsx/index.js +7 -0
  33. package/dist/lodash/array.d.ts +5 -1
  34. package/dist/lodash/array.js +3 -1
  35. package/dist/lodash/async.d.ts +6 -0
  36. package/dist/lodash/async.js +6 -0
  37. package/dist/lodash/index.d.ts +3 -1
  38. package/dist/lodash/index.js +27 -3
  39. package/dist/lodash/random.js +2 -2
  40. package/dist/lodash/str.d.ts +75 -0
  41. package/dist/lodash/str.js +20 -0
  42. package/dist/reactive/access.js +5 -3
  43. package/dist/reactive/create-debounce-watch.d.ts +12 -0
  44. package/dist/reactive/create-debounce-watch.js +14 -0
  45. package/dist/reactive/index.d.ts +1 -0
  46. package/dist/reactive/index.js +9 -4
  47. package/dist/types/fn.d.ts +2 -1
  48. package/dist/types/fn.js +1 -0
  49. package/dist/types/index.d.ts +1 -0
  50. package/dist/types/index.js +2 -1
  51. package/package.json +1 -2
  52. package/dist/chunk-2BGAGVTR.js +0 -7
  53. package/dist/chunk-H6VUVMSF.js +0 -23
  54. package/dist/chunk-WY5G2PJM.js +0 -60
  55. /package/dist/{chunk-2BUPSB7O.js → chunk-AZAXMGEB.js} +0 -0
  56. /package/dist/{chunk-33ZRZ4S2.js → chunk-B6TZK2S5.js} +0 -0
  57. /package/dist/{chunk-M53KPXWR.js → chunk-OECLQ3OT.js} +0 -0
  58. /package/dist/{chunk-ZZNAXGNU.js → chunk-SK6Y2YH6.js} +0 -0
@@ -1,60 +0,0 @@
1
- import {
2
- access
3
- } from "./chunk-M5A3VVYI.js";
4
- import {
5
- createWatch
6
- } from "./chunk-4L6FK7MF.js";
7
- import {
8
- isNumber
9
- } from "./chunk-ZGYORUAX.js";
10
-
11
- // src/fn/create-loop-exec.ts
12
- import { onCleanup } from "solid-js";
13
- function createLoopExec(fn, delay) {
14
- let shouldStop = false;
15
- let isCleanedUp = false;
16
- let timer;
17
- const execFn = async () => {
18
- clearTimeout(timer);
19
- const d = access(delay);
20
- if (shouldStop || !isNumber(d) || d < 0) {
21
- return;
22
- }
23
- try {
24
- await fn();
25
- } finally {
26
- timer = setTimeout(() => {
27
- execFn();
28
- }, d);
29
- }
30
- };
31
- createWatch(
32
- () => access(delay),
33
- () => {
34
- execFn();
35
- }
36
- );
37
- const stop = () => {
38
- shouldStop = true;
39
- clearTimeout(timer);
40
- };
41
- const start = () => {
42
- if (isCleanedUp) {
43
- return;
44
- }
45
- shouldStop = false;
46
- execFn();
47
- };
48
- onCleanup(() => {
49
- isCleanedUp = true;
50
- stop();
51
- });
52
- return {
53
- stop,
54
- start
55
- };
56
- }
57
-
58
- export {
59
- createLoopExec
60
- };
File without changes
File without changes
File without changes
File without changes