@tanstack/preact-pacer 0.22.1 → 0.24.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 (243) hide show
  1. package/README.md +17 -2
  2. package/dist/async-batcher/useAsyncBatchedCallback.d.ts +2 -5
  3. package/dist/async-batcher/useAsyncBatchedCallback.js +1 -2
  4. package/dist/async-batcher/useAsyncBatcher.d.ts +4 -8
  5. package/dist/async-batcher/useAsyncBatcher.js +1 -3
  6. package/dist/async-debouncer/useAsyncDebouncedCallback.d.ts +6 -7
  7. package/dist/async-debouncer/useAsyncDebouncedCallback.js +5 -4
  8. package/dist/async-debouncer/useAsyncDebouncer.d.ts +4 -7
  9. package/dist/async-debouncer/useAsyncDebouncer.js +1 -2
  10. package/dist/async-queuer/useAsyncQueuedState.d.ts +4 -7
  11. package/dist/async-queuer/useAsyncQueuedState.js +3 -4
  12. package/dist/async-queuer/useAsyncQueuer.d.ts +6 -9
  13. package/dist/async-queuer/useAsyncQueuer.js +3 -4
  14. package/dist/async-rate-limiter/useAsyncRateLimitedCallback.d.ts +2 -5
  15. package/dist/async-rate-limiter/useAsyncRateLimitedCallback.js +1 -2
  16. package/dist/async-rate-limiter/useAsyncRateLimiter.d.ts +4 -7
  17. package/dist/async-rate-limiter/useAsyncRateLimiter.js +1 -2
  18. package/dist/async-throttler/useAsyncThrottledCallback.d.ts +7 -9
  19. package/dist/async-throttler/useAsyncThrottledCallback.js +6 -6
  20. package/dist/async-throttler/useAsyncThrottler.d.ts +4 -7
  21. package/dist/async-throttler/useAsyncThrottler.js +1 -2
  22. package/dist/batcher/useBatchedCallback.d.ts +2 -5
  23. package/dist/batcher/useBatchedCallback.js +1 -2
  24. package/dist/batcher/useBatcher.d.ts +6 -11
  25. package/dist/batcher/useBatcher.js +3 -6
  26. package/dist/debouncer/useDebouncedCallback.d.ts +2 -5
  27. package/dist/debouncer/useDebouncedCallback.js +1 -2
  28. package/dist/debouncer/useDebouncedState.d.ts +2 -5
  29. package/dist/debouncer/useDebouncedState.js +1 -2
  30. package/dist/debouncer/useDebouncedValue.d.ts +2 -5
  31. package/dist/debouncer/useDebouncedValue.js +1 -2
  32. package/dist/debouncer/useDebouncer.d.ts +4 -7
  33. package/dist/debouncer/useDebouncer.js +1 -2
  34. package/dist/provider/PacerProvider.d.ts +6 -13
  35. package/dist/provider/PacerProvider.js +1 -2
  36. package/dist/queuer/useQueuedState.d.ts +2 -5
  37. package/dist/queuer/useQueuedState.js +1 -2
  38. package/dist/queuer/useQueuedValue.d.ts +2 -5
  39. package/dist/queuer/useQueuedValue.js +1 -2
  40. package/dist/queuer/useQueuer.d.ts +4 -7
  41. package/dist/queuer/useQueuer.js +1 -2
  42. package/dist/rate-limiter/useRateLimitedCallback.d.ts +2 -5
  43. package/dist/rate-limiter/useRateLimitedCallback.js +1 -2
  44. package/dist/rate-limiter/useRateLimitedState.d.ts +2 -5
  45. package/dist/rate-limiter/useRateLimitedState.js +1 -2
  46. package/dist/rate-limiter/useRateLimitedValue.d.ts +2 -5
  47. package/dist/rate-limiter/useRateLimitedValue.js +1 -2
  48. package/dist/rate-limiter/useRateLimiter.d.ts +4 -7
  49. package/dist/rate-limiter/useRateLimiter.js +1 -2
  50. package/dist/throttler/useThrottledCallback.d.ts +2 -5
  51. package/dist/throttler/useThrottledCallback.js +1 -2
  52. package/dist/throttler/useThrottledState.d.ts +2 -5
  53. package/dist/throttler/useThrottledState.js +1 -2
  54. package/dist/throttler/useThrottledValue.d.ts +2 -5
  55. package/dist/throttler/useThrottledValue.js +1 -2
  56. package/dist/throttler/useThrottler.d.ts +4 -7
  57. package/dist/throttler/useThrottler.js +1 -2
  58. package/package.json +24 -72
  59. package/dist/async-batcher/index.cjs +0 -13
  60. package/dist/async-batcher/index.d.cts +0 -4
  61. package/dist/async-batcher/useAsyncBatchedCallback.cjs +0 -51
  62. package/dist/async-batcher/useAsyncBatchedCallback.cjs.map +0 -1
  63. package/dist/async-batcher/useAsyncBatchedCallback.d.cts +0 -44
  64. package/dist/async-batcher/useAsyncBatchedCallback.js.map +0 -1
  65. package/dist/async-batcher/useAsyncBatcher.cjs +0 -217
  66. package/dist/async-batcher/useAsyncBatcher.cjs.map +0 -1
  67. package/dist/async-batcher/useAsyncBatcher.d.cts +0 -224
  68. package/dist/async-batcher/useAsyncBatcher.js.map +0 -1
  69. package/dist/async-debouncer/index.cjs +0 -13
  70. package/dist/async-debouncer/index.d.cts +0 -4
  71. package/dist/async-debouncer/useAsyncDebouncedCallback.cjs +0 -50
  72. package/dist/async-debouncer/useAsyncDebouncedCallback.cjs.map +0 -1
  73. package/dist/async-debouncer/useAsyncDebouncedCallback.d.cts +0 -46
  74. package/dist/async-debouncer/useAsyncDebouncedCallback.js.map +0 -1
  75. package/dist/async-debouncer/useAsyncDebouncer.cjs +0 -195
  76. package/dist/async-debouncer/useAsyncDebouncer.cjs.map +0 -1
  77. package/dist/async-debouncer/useAsyncDebouncer.d.cts +0 -203
  78. package/dist/async-debouncer/useAsyncDebouncer.js.map +0 -1
  79. package/dist/async-queuer/index.cjs +0 -13
  80. package/dist/async-queuer/index.d.cts +0 -4
  81. package/dist/async-queuer/useAsyncQueuedState.cjs +0 -154
  82. package/dist/async-queuer/useAsyncQueuedState.cjs.map +0 -1
  83. package/dist/async-queuer/useAsyncQueuedState.d.cts +0 -151
  84. package/dist/async-queuer/useAsyncQueuedState.js.map +0 -1
  85. package/dist/async-queuer/useAsyncQueuer.cjs +0 -217
  86. package/dist/async-queuer/useAsyncQueuer.cjs.map +0 -1
  87. package/dist/async-queuer/useAsyncQueuer.d.cts +0 -224
  88. package/dist/async-queuer/useAsyncQueuer.js.map +0 -1
  89. package/dist/async-rate-limiter/index.cjs +0 -13
  90. package/dist/async-rate-limiter/index.d.cts +0 -4
  91. package/dist/async-rate-limiter/useAsyncRateLimitedCallback.cjs +0 -65
  92. package/dist/async-rate-limiter/useAsyncRateLimitedCallback.cjs.map +0 -1
  93. package/dist/async-rate-limiter/useAsyncRateLimitedCallback.d.cts +0 -61
  94. package/dist/async-rate-limiter/useAsyncRateLimitedCallback.js.map +0 -1
  95. package/dist/async-rate-limiter/useAsyncRateLimiter.cjs +0 -209
  96. package/dist/async-rate-limiter/useAsyncRateLimiter.cjs.map +0 -1
  97. package/dist/async-rate-limiter/useAsyncRateLimiter.d.cts +0 -220
  98. package/dist/async-rate-limiter/useAsyncRateLimiter.js.map +0 -1
  99. package/dist/async-retryer/index.cjs +0 -9
  100. package/dist/async-retryer/index.d.cts +0 -1
  101. package/dist/async-throttler/index.cjs +0 -13
  102. package/dist/async-throttler/index.d.cts +0 -4
  103. package/dist/async-throttler/useAsyncThrottledCallback.cjs +0 -48
  104. package/dist/async-throttler/useAsyncThrottledCallback.cjs.map +0 -1
  105. package/dist/async-throttler/useAsyncThrottledCallback.d.cts +0 -44
  106. package/dist/async-throttler/useAsyncThrottledCallback.js.map +0 -1
  107. package/dist/async-throttler/useAsyncThrottler.cjs +0 -206
  108. package/dist/async-throttler/useAsyncThrottler.cjs.map +0 -1
  109. package/dist/async-throttler/useAsyncThrottler.d.cts +0 -214
  110. package/dist/async-throttler/useAsyncThrottler.js.map +0 -1
  111. package/dist/batcher/index.cjs +0 -13
  112. package/dist/batcher/index.d.cts +0 -4
  113. package/dist/batcher/useBatchedCallback.cjs +0 -47
  114. package/dist/batcher/useBatchedCallback.cjs.map +0 -1
  115. package/dist/batcher/useBatchedCallback.d.cts +0 -42
  116. package/dist/batcher/useBatchedCallback.js.map +0 -1
  117. package/dist/batcher/useBatcher.cjs +0 -165
  118. package/dist/batcher/useBatcher.cjs.map +0 -1
  119. package/dist/batcher/useBatcher.d.cts +0 -175
  120. package/dist/batcher/useBatcher.js.map +0 -1
  121. package/dist/debouncer/index.cjs +0 -17
  122. package/dist/debouncer/index.d.cts +0 -6
  123. package/dist/debouncer/useDebouncedCallback.cjs +0 -48
  124. package/dist/debouncer/useDebouncedCallback.cjs.map +0 -1
  125. package/dist/debouncer/useDebouncedCallback.d.cts +0 -44
  126. package/dist/debouncer/useDebouncedCallback.js.map +0 -1
  127. package/dist/debouncer/useDebouncedState.cjs +0 -89
  128. package/dist/debouncer/useDebouncedState.cjs.map +0 -1
  129. package/dist/debouncer/useDebouncedState.d.cts +0 -81
  130. package/dist/debouncer/useDebouncedState.js.map +0 -1
  131. package/dist/debouncer/useDebouncedValue.cjs +0 -96
  132. package/dist/debouncer/useDebouncedValue.cjs.map +0 -1
  133. package/dist/debouncer/useDebouncedValue.d.cts +0 -90
  134. package/dist/debouncer/useDebouncedValue.js.map +0 -1
  135. package/dist/debouncer/useDebouncer.cjs +0 -141
  136. package/dist/debouncer/useDebouncer.cjs.map +0 -1
  137. package/dist/debouncer/useDebouncer.d.cts +0 -152
  138. package/dist/debouncer/useDebouncer.js.map +0 -1
  139. package/dist/index.cjs +0 -67
  140. package/dist/index.d.cts +0 -30
  141. package/dist/provider/PacerProvider.cjs +0 -26
  142. package/dist/provider/PacerProvider.cjs.map +0 -1
  143. package/dist/provider/PacerProvider.d.cts +0 -33
  144. package/dist/provider/PacerProvider.js.map +0 -1
  145. package/dist/provider/index.cjs +0 -6
  146. package/dist/provider/index.d.cts +0 -2
  147. package/dist/queuer/index.cjs +0 -15
  148. package/dist/queuer/index.d.cts +0 -5
  149. package/dist/queuer/useQueuedState.cjs +0 -129
  150. package/dist/queuer/useQueuedState.cjs.map +0 -1
  151. package/dist/queuer/useQueuedState.d.cts +0 -122
  152. package/dist/queuer/useQueuedState.js.map +0 -1
  153. package/dist/queuer/useQueuedValue.cjs +0 -115
  154. package/dist/queuer/useQueuedValue.cjs.map +0 -1
  155. package/dist/queuer/useQueuedValue.d.cts +0 -105
  156. package/dist/queuer/useQueuedValue.js.map +0 -1
  157. package/dist/queuer/useQueuer.cjs +0 -176
  158. package/dist/queuer/useQueuer.cjs.map +0 -1
  159. package/dist/queuer/useQueuer.d.cts +0 -186
  160. package/dist/queuer/useQueuer.js.map +0 -1
  161. package/dist/rate-limiter/index.cjs +0 -17
  162. package/dist/rate-limiter/index.d.cts +0 -6
  163. package/dist/rate-limiter/useRateLimitedCallback.cjs +0 -65
  164. package/dist/rate-limiter/useRateLimitedCallback.cjs.map +0 -1
  165. package/dist/rate-limiter/useRateLimitedCallback.d.cts +0 -61
  166. package/dist/rate-limiter/useRateLimitedCallback.js.map +0 -1
  167. package/dist/rate-limiter/useRateLimitedState.cjs +0 -115
  168. package/dist/rate-limiter/useRateLimitedState.cjs.map +0 -1
  169. package/dist/rate-limiter/useRateLimitedState.d.cts +0 -107
  170. package/dist/rate-limiter/useRateLimitedState.js.map +0 -1
  171. package/dist/rate-limiter/useRateLimitedValue.cjs +0 -102
  172. package/dist/rate-limiter/useRateLimitedValue.cjs.map +0 -1
  173. package/dist/rate-limiter/useRateLimitedValue.d.cts +0 -96
  174. package/dist/rate-limiter/useRateLimitedValue.js.map +0 -1
  175. package/dist/rate-limiter/useRateLimiter.cjs +0 -167
  176. package/dist/rate-limiter/useRateLimiter.cjs.map +0 -1
  177. package/dist/rate-limiter/useRateLimiter.d.cts +0 -179
  178. package/dist/rate-limiter/useRateLimiter.js.map +0 -1
  179. package/dist/throttler/index.cjs +0 -17
  180. package/dist/throttler/index.d.cts +0 -6
  181. package/dist/throttler/useThrottledCallback.cjs +0 -49
  182. package/dist/throttler/useThrottledCallback.cjs.map +0 -1
  183. package/dist/throttler/useThrottledCallback.d.cts +0 -45
  184. package/dist/throttler/useThrottledCallback.js.map +0 -1
  185. package/dist/throttler/useThrottledState.cjs +0 -100
  186. package/dist/throttler/useThrottledState.cjs.map +0 -1
  187. package/dist/throttler/useThrottledState.d.cts +0 -92
  188. package/dist/throttler/useThrottledState.js.map +0 -1
  189. package/dist/throttler/useThrottledValue.cjs +0 -91
  190. package/dist/throttler/useThrottledValue.cjs.map +0 -1
  191. package/dist/throttler/useThrottledValue.d.cts +0 -85
  192. package/dist/throttler/useThrottledValue.js.map +0 -1
  193. package/dist/throttler/useThrottler.cjs +0 -146
  194. package/dist/throttler/useThrottler.cjs.map +0 -1
  195. package/dist/throttler/useThrottler.d.cts +0 -157
  196. package/dist/throttler/useThrottler.js.map +0 -1
  197. package/dist/types/index.cjs +0 -9
  198. package/dist/types/index.d.cts +0 -1
  199. package/dist/utils/index.cjs +0 -9
  200. package/dist/utils/index.d.cts +0 -1
  201. package/src/async-batcher/index.ts +0 -4
  202. package/src/async-batcher/useAsyncBatchedCallback.ts +0 -53
  203. package/src/async-batcher/useAsyncBatcher.ts +0 -293
  204. package/src/async-debouncer/index.ts +0 -5
  205. package/src/async-debouncer/useAsyncDebouncedCallback.ts +0 -54
  206. package/src/async-debouncer/useAsyncDebouncer.ts +0 -274
  207. package/src/async-queuer/index.ts +0 -4
  208. package/src/async-queuer/useAsyncQueuedState.ts +0 -165
  209. package/src/async-queuer/useAsyncQueuer.ts +0 -293
  210. package/src/async-rate-limiter/index.ts +0 -5
  211. package/src/async-rate-limiter/useAsyncRateLimitedCallback.ts +0 -69
  212. package/src/async-rate-limiter/useAsyncRateLimiter.ts +0 -294
  213. package/src/async-retryer/index.ts +0 -2
  214. package/src/async-throttler/index.ts +0 -5
  215. package/src/async-throttler/useAsyncThrottledCallback.ts +0 -52
  216. package/src/async-throttler/useAsyncThrottler.ts +0 -285
  217. package/src/batcher/index.ts +0 -4
  218. package/src/batcher/useBatchedCallback.ts +0 -46
  219. package/src/batcher/useBatcher.ts +0 -241
  220. package/src/debouncer/index.ts +0 -7
  221. package/src/debouncer/useDebouncedCallback.ts +0 -51
  222. package/src/debouncer/useDebouncedState.ts +0 -106
  223. package/src/debouncer/useDebouncedValue.ts +0 -109
  224. package/src/debouncer/useDebouncer.ts +0 -219
  225. package/src/index.ts +0 -56
  226. package/src/provider/PacerProvider.tsx +0 -70
  227. package/src/provider/index.ts +0 -1
  228. package/src/queuer/index.ts +0 -5
  229. package/src/queuer/useQueuedState.ts +0 -133
  230. package/src/queuer/useQueuedValue.ts +0 -129
  231. package/src/queuer/useQueuer.ts +0 -251
  232. package/src/rate-limiter/index.ts +0 -6
  233. package/src/rate-limiter/useRateLimitedCallback.ts +0 -68
  234. package/src/rate-limiter/useRateLimitedState.ts +0 -124
  235. package/src/rate-limiter/useRateLimitedValue.ts +0 -110
  236. package/src/rate-limiter/useRateLimiter.ts +0 -244
  237. package/src/throttler/index.ts +0 -7
  238. package/src/throttler/useThrottledCallback.ts +0 -52
  239. package/src/throttler/useThrottledState.ts +0 -118
  240. package/src/throttler/useThrottledValue.ts +0 -104
  241. package/src/throttler/useThrottler.ts +0 -224
  242. package/src/types/index.ts +0 -1
  243. package/src/utils/index.ts +0 -1
package/README.md CHANGED
@@ -1,5 +1,19 @@
1
1
  <div align="center">
2
- <img src="./media/header_pacer.png" >
2
+ <picture>
3
+ <source
4
+ media="(prefers-color-scheme: dark)"
5
+ srcset="https://tanstack.com/api/readme/pacer.png?framework=preact&theme=dark"
6
+ />
7
+ <source
8
+ media="(prefers-color-scheme: light)"
9
+ srcset="https://tanstack.com/api/readme/pacer.png?framework=preact"
10
+ />
11
+ <img
12
+ src="https://tanstack.com/api/readme/pacer.png?framework=preact"
13
+ alt="TanStack Preact Pacer"
14
+ width="900"
15
+ />
16
+ </picture>
3
17
  </div>
4
18
 
5
19
  <br />
@@ -29,8 +43,9 @@
29
43
  </div>
30
44
 
31
45
  <div align="center">
32
-
46
+
33
47
  ### [Become a Sponsor!](https://github.com/sponsors/tannerlinsley/)
48
+
34
49
  </div>
35
50
 
36
51
  # TanStack Pacer
@@ -1,5 +1,4 @@
1
1
  import { PreactAsyncBatcherOptions } from "./useAsyncBatcher.js";
2
-
3
2
  //#region src/async-batcher/useAsyncBatchedCallback.d.ts
4
3
  /**
5
4
  * A Preact hook that creates a batched version of an async callback function.
@@ -38,7 +37,5 @@ import { PreactAsyncBatcherOptions } from "./useAsyncBatcher.js";
38
37
  * </button>
39
38
  * ```
40
39
  */
41
- declare function useAsyncBatchedCallback<TValue>(fn: (items: Array<TValue>) => Promise<unknown>, options: PreactAsyncBatcherOptions<TValue, {}>): (item: TValue) => Promise<void>;
42
- //#endregion
43
- export { useAsyncBatchedCallback };
44
- //# sourceMappingURL=useAsyncBatchedCallback.d.ts.map
40
+ export declare function useAsyncBatchedCallback<TValue>(fn: (items: Array<TValue>) => Promise<unknown>, options: PreactAsyncBatcherOptions<TValue, {}>): (item: TValue) => Promise<void>;
41
+ //#endregion
@@ -47,5 +47,4 @@ function useAsyncBatchedCallback(fn, options) {
47
47
  }
48
48
 
49
49
  //#endregion
50
- export { useAsyncBatchedCallback };
51
- //# sourceMappingURL=useAsyncBatchedCallback.js.map
50
+ export { useAsyncBatchedCallback };
@@ -1,16 +1,15 @@
1
1
  import { ComponentChildren } from "preact";
2
2
  import { AsyncBatcher, AsyncBatcherOptions, AsyncBatcherState } from "@tanstack/pacer/async-batcher";
3
3
  import { Store } from "@tanstack/preact-store";
4
-
5
4
  //#region src/async-batcher/useAsyncBatcher.d.ts
6
- interface PreactAsyncBatcherOptions<TValue, TSelected = {}> extends AsyncBatcherOptions<TValue> {
5
+ export interface PreactAsyncBatcherOptions<TValue, TSelected = {}> extends AsyncBatcherOptions<TValue> {
7
6
  /**
8
7
  * Optional callback invoked when the component unmounts. Receives the batcher instance.
9
8
  * When provided, replaces the default cleanup (cancel + abort); use it to call flush(), reset(), cancel(), add logging, etc.
10
9
  */
11
10
  onUnmount?: (batcher: PreactAsyncBatcher<TValue, TSelected>) => void;
12
11
  }
13
- interface PreactAsyncBatcher<TValue, TSelected = {}> extends Omit<AsyncBatcher<TValue>, 'store'> {
12
+ export interface PreactAsyncBatcher<TValue, TSelected = {}> extends Omit<AsyncBatcher<TValue>, 'store'> {
14
13
  /**
15
14
  * A Preact HOC (Higher Order Component) that allows you to subscribe to the async batcher state.
16
15
  *
@@ -97,7 +96,6 @@ interface PreactAsyncBatcher<TValue, TSelected = {}> extends Omit<AsyncBatcher<T
97
96
  * - `isEmpty`: Whether the batcher has no items to process
98
97
  * - `isExecuting`: Whether a batch is currently being processed asynchronously
99
98
  * - `isPending`: Whether the batcher is waiting for the timeout to trigger batch processing
100
- * - `isRunning`: Whether the batcher is active and will process items automatically
101
99
  * - `items`: Array of items currently queued for batch processing
102
100
  * - `lastResult`: The result from the most recent batch execution
103
101
  * - `settleCount`: Number of batch executions that have completed (success or error)
@@ -218,7 +216,5 @@ interface PreactAsyncBatcher<TValue, TSelected = {}> extends Omit<AsyncBatcher<T
218
216
  * const { isExecuting, lastResult, size } = asyncBatcher.state;
219
217
  * ```
220
218
  */
221
- declare function useAsyncBatcher<TValue, TSelected = {}>(fn: (items: Array<TValue>) => Promise<any>, options?: PreactAsyncBatcherOptions<TValue, TSelected>, selector?: (state: AsyncBatcherState<TValue>) => TSelected): PreactAsyncBatcher<TValue, TSelected>;
222
- //#endregion
223
- export { PreactAsyncBatcher, PreactAsyncBatcherOptions, useAsyncBatcher };
224
- //# sourceMappingURL=useAsyncBatcher.d.ts.map
219
+ export declare function useAsyncBatcher<TValue, TSelected = {}>(fn: (items: Array<TValue>) => Promise<any>, options?: PreactAsyncBatcherOptions<TValue, TSelected>, selector?: (state: AsyncBatcherState<TValue>) => TSelected): PreactAsyncBatcher<TValue, TSelected>;
220
+ //#endregion
@@ -60,7 +60,6 @@ import { shallow, useSelector } from "@tanstack/preact-store";
60
60
  * - `isEmpty`: Whether the batcher has no items to process
61
61
  * - `isExecuting`: Whether a batch is currently being processed asynchronously
62
62
  * - `isPending`: Whether the batcher is waiting for the timeout to trigger batch processing
63
- * - `isRunning`: Whether the batcher is active and will process items automatically
64
63
  * - `items`: Array of items currently queued for batch processing
65
64
  * - `lastResult`: The result from the most recent batch execution
66
65
  * - `settleCount`: Number of batch executions that have completed (success or error)
@@ -213,5 +212,4 @@ function useAsyncBatcher(fn, options = {}, selector = () => ({})) {
213
212
  }
214
213
 
215
214
  //#endregion
216
- export { useAsyncBatcher };
217
- //# sourceMappingURL=useAsyncBatcher.js.map
215
+ export { useAsyncBatcher };
@@ -1,6 +1,5 @@
1
1
  import { PreactAsyncDebouncerOptions } from "./useAsyncDebouncer.js";
2
2
  import { AnyAsyncFunction } from "@tanstack/pacer/types";
3
-
4
3
  //#region src/async-debouncer/useAsyncDebouncedCallback.d.ts
5
4
  /**
6
5
  * A Preact hook that creates a debounced version of an async callback function.
@@ -9,8 +8,10 @@ import { AnyAsyncFunction } from "@tanstack/pacer/types";
9
8
  *
10
9
  * The debounced async function will only execute after the specified wait time has elapsed
11
10
  * since its last invocation. If called again before the wait time expires, the timer
12
- * resets and starts waiting again. The returned function always returns a promise
13
- * that resolves or rejects with the result of the original async function.
11
+ * resets and starts waiting again. The returned function always returns a promise. The call
12
+ * that triggers an execution resolves or rejects with that execution's result; superseded
13
+ * calls resolve with the most recent result (which may be `undefined` if nothing has executed
14
+ * yet), and calls made while the debouncer is disabled resolve with `undefined`.
14
15
  *
15
16
  * This hook provides a simpler API compared to `useAsyncDebouncer`, making it ideal for basic
16
17
  * async debouncing needs. However, it does not expose the underlying AsyncDebouncer instance.
@@ -40,7 +41,5 @@ import { AnyAsyncFunction } from "@tanstack/pacer/types";
40
41
  * />
41
42
  * ```
42
43
  */
43
- declare function useAsyncDebouncedCallback<TFn extends AnyAsyncFunction>(fn: TFn, options: PreactAsyncDebouncerOptions<TFn, {}>): (...args: Parameters<TFn>) => Promise<ReturnType<TFn>>;
44
- //#endregion
45
- export { useAsyncDebouncedCallback };
46
- //# sourceMappingURL=useAsyncDebouncedCallback.d.ts.map
44
+ export declare function useAsyncDebouncedCallback<TFn extends AnyAsyncFunction>(fn: TFn, options: PreactAsyncDebouncerOptions<TFn, {}>): (...args: Parameters<TFn>) => Promise<Awaited<ReturnType<TFn>> | undefined>;
45
+ //#endregion
@@ -9,8 +9,10 @@ import { useCallback } from "preact/hooks";
9
9
  *
10
10
  * The debounced async function will only execute after the specified wait time has elapsed
11
11
  * since its last invocation. If called again before the wait time expires, the timer
12
- * resets and starts waiting again. The returned function always returns a promise
13
- * that resolves or rejects with the result of the original async function.
12
+ * resets and starts waiting again. The returned function always returns a promise. The call
13
+ * that triggers an execution resolves or rejects with that execution's result; superseded
14
+ * calls resolve with the most recent result (which may be `undefined` if nothing has executed
15
+ * yet), and calls made while the debouncer is disabled resolve with `undefined`.
14
16
  *
15
17
  * This hook provides a simpler API compared to `useAsyncDebouncer`, making it ideal for basic
16
18
  * async debouncing needs. However, it does not expose the underlying AsyncDebouncer instance.
@@ -46,5 +48,4 @@ function useAsyncDebouncedCallback(fn, options) {
46
48
  }
47
49
 
48
50
  //#endregion
49
- export { useAsyncDebouncedCallback };
50
- //# sourceMappingURL=useAsyncDebouncedCallback.js.map
51
+ export { useAsyncDebouncedCallback };
@@ -2,16 +2,15 @@ import { ComponentChildren } from "preact";
2
2
  import { Store } from "@tanstack/preact-store";
3
3
  import { AsyncDebouncer, AsyncDebouncerOptions, AsyncDebouncerState } from "@tanstack/pacer/async-debouncer";
4
4
  import { AnyAsyncFunction } from "@tanstack/pacer/types";
5
-
6
5
  //#region src/async-debouncer/useAsyncDebouncer.d.ts
7
- interface PreactAsyncDebouncerOptions<TFn extends AnyAsyncFunction, TSelected = {}> extends AsyncDebouncerOptions<TFn> {
6
+ export interface PreactAsyncDebouncerOptions<TFn extends AnyAsyncFunction, TSelected = {}> extends AsyncDebouncerOptions<TFn> {
8
7
  /**
9
8
  * Optional callback invoked when the component unmounts. Receives the debouncer instance.
10
9
  * When provided, replaces the default cleanup (cancel + abort); use it to call flush(), reset(), cancel(), add logging, etc.
11
10
  */
12
11
  onUnmount?: (debouncer: PreactAsyncDebouncer<TFn, TSelected>) => void;
13
12
  }
14
- interface PreactAsyncDebouncer<TFn extends AnyAsyncFunction, TSelected = {}> extends Omit<AsyncDebouncer<TFn>, 'store'> {
13
+ export interface PreactAsyncDebouncer<TFn extends AnyAsyncFunction, TSelected = {}> extends Omit<AsyncDebouncer<TFn>, 'store'> {
15
14
  /**
16
15
  * A Preact HOC (Higher Order Component) that allows you to subscribe to the async debouncer state.
17
16
  *
@@ -197,7 +196,5 @@ interface PreactAsyncDebouncer<TFn extends AnyAsyncFunction, TSelected = {}> ext
197
196
  * const { isExecuting, lastResult } = state;
198
197
  * ```
199
198
  */
200
- declare function useAsyncDebouncer<TFn extends AnyAsyncFunction, TSelected = {}>(fn: TFn, options: PreactAsyncDebouncerOptions<TFn, TSelected>, selector?: (state: AsyncDebouncerState<TFn>) => TSelected): PreactAsyncDebouncer<TFn, TSelected>;
201
- //#endregion
202
- export { PreactAsyncDebouncer, PreactAsyncDebouncerOptions, useAsyncDebouncer };
203
- //# sourceMappingURL=useAsyncDebouncer.d.ts.map
199
+ export declare function useAsyncDebouncer<TFn extends AnyAsyncFunction, TSelected = {}>(fn: TFn, options: PreactAsyncDebouncerOptions<TFn, TSelected>, selector?: (state: AsyncDebouncerState<TFn>) => TSelected): PreactAsyncDebouncer<TFn, TSelected>;
200
+ //#endregion
@@ -191,5 +191,4 @@ function useAsyncDebouncer(fn, options, selector = () => ({})) {
191
191
  }
192
192
 
193
193
  //#endregion
194
- export { useAsyncDebouncer };
195
- //# sourceMappingURL=useAsyncDebouncer.js.map
194
+ export { useAsyncDebouncer };
@@ -1,6 +1,5 @@
1
1
  import { PreactAsyncQueuer, PreactAsyncQueuerOptions } from "./useAsyncQueuer.js";
2
2
  import { AsyncQueuerState } from "@tanstack/pacer/async-queuer";
3
-
4
3
  //#region src/async-queuer/useAsyncQueuedState.d.ts
5
4
  /**
6
5
  * A higher-level Preact hook that creates an `AsyncQueuer` instance with built-in state management.
@@ -46,7 +45,7 @@ import { AsyncQueuerState } from "@tanstack/pacer/async-queuer";
46
45
  * - `lastResult`: The result from the most recent task execution
47
46
  * - `pendingTick`: Whether the queuer has a pending timeout for processing the next item
48
47
  * - `rejectionCount`: Number of items that have been rejected from being added
49
- * - `settledCount`: Number of task executions that have completed (success or error)
48
+ * - `settleCount`: Number of task executions that have completed (success or error)
50
49
  * - `size`: Number of items currently in the queue
51
50
  * - `status`: Current processing status ('idle' | 'running' | 'stopped')
52
51
  * - `successCount`: Number of task executions that have completed successfully
@@ -107,7 +106,7 @@ import { AsyncQueuerState } from "@tanstack/pacer/async-queuer";
107
106
  * (state) => ({
108
107
  * successCount: state.successCount,
109
108
  * errorCount: state.errorCount,
110
- * settledCount: state.settledCount,
109
+ * settleCount: state.settleCount,
111
110
  * expirationCount: state.expirationCount,
112
111
  * rejectionCount: state.rejectionCount
113
112
  * })
@@ -145,7 +144,5 @@ import { AsyncQueuerState } from "@tanstack/pacer/async-queuer";
145
144
  * const { size, isRunning, activeItems } = asyncQueuer.state;
146
145
  * ```
147
146
  */
148
- declare function useAsyncQueuedState<TValue, TSelected extends Pick<AsyncQueuerState<TValue>, 'items'> = Pick<AsyncQueuerState<TValue>, 'items'>>(fn: (value: TValue) => Promise<any>, options?: PreactAsyncQueuerOptions<TValue, TSelected>, selector?: (state: AsyncQueuerState<TValue>) => TSelected): [Array<TValue>, PreactAsyncQueuer<TValue, TSelected>];
149
- //#endregion
150
- export { useAsyncQueuedState };
151
- //# sourceMappingURL=useAsyncQueuedState.d.ts.map
147
+ export declare function useAsyncQueuedState<TValue, TSelected extends Pick<AsyncQueuerState<TValue>, 'items'> = Pick<AsyncQueuerState<TValue>, 'items'>>(fn: (value: TValue) => Promise<any>, options?: PreactAsyncQueuerOptions<TValue, TSelected>, selector?: (state: AsyncQueuerState<TValue>) => TSelected): [Array<TValue>, PreactAsyncQueuer<TValue, TSelected>];
148
+ //#endregion
@@ -45,7 +45,7 @@ import { useAsyncQueuer } from "./useAsyncQueuer.js";
45
45
  * - `lastResult`: The result from the most recent task execution
46
46
  * - `pendingTick`: Whether the queuer has a pending timeout for processing the next item
47
47
  * - `rejectionCount`: Number of items that have been rejected from being added
48
- * - `settledCount`: Number of task executions that have completed (success or error)
48
+ * - `settleCount`: Number of task executions that have completed (success or error)
49
49
  * - `size`: Number of items currently in the queue
50
50
  * - `status`: Current processing status ('idle' | 'running' | 'stopped')
51
51
  * - `successCount`: Number of task executions that have completed successfully
@@ -106,7 +106,7 @@ import { useAsyncQueuer } from "./useAsyncQueuer.js";
106
106
  * (state) => ({
107
107
  * successCount: state.successCount,
108
108
  * errorCount: state.errorCount,
109
- * settledCount: state.settledCount,
109
+ * settleCount: state.settleCount,
110
110
  * expirationCount: state.expirationCount,
111
111
  * rejectionCount: state.rejectionCount
112
112
  * })
@@ -150,5 +150,4 @@ function useAsyncQueuedState(fn, options = {}, selector) {
150
150
  }
151
151
 
152
152
  //#endregion
153
- export { useAsyncQueuedState };
154
- //# sourceMappingURL=useAsyncQueuedState.js.map
153
+ export { useAsyncQueuedState };
@@ -1,16 +1,15 @@
1
1
  import { ComponentChildren } from "preact";
2
2
  import { Store } from "@tanstack/preact-store";
3
3
  import { AsyncQueuer, AsyncQueuerOptions, AsyncQueuerState } from "@tanstack/pacer/async-queuer";
4
-
5
4
  //#region src/async-queuer/useAsyncQueuer.d.ts
6
- interface PreactAsyncQueuerOptions<TValue, TSelected = {}> extends AsyncQueuerOptions<TValue> {
5
+ export interface PreactAsyncQueuerOptions<TValue, TSelected = {}> extends AsyncQueuerOptions<TValue> {
7
6
  /**
8
7
  * Optional callback invoked when the component unmounts. Receives the queuer instance.
9
8
  * When provided, replaces the default cleanup (stop + abort); use it to call flush(), flushAsBatch(), stop(), add logging, etc.
10
9
  */
11
10
  onUnmount?: (queuer: PreactAsyncQueuer<TValue, TSelected>) => void;
12
11
  }
13
- interface PreactAsyncQueuer<TValue, TSelected = {}> extends Omit<AsyncQueuer<TValue>, 'store'> {
12
+ export interface PreactAsyncQueuer<TValue, TSelected = {}> extends Omit<AsyncQueuer<TValue>, 'store'> {
14
13
  /**
15
14
  * A Preact HOC (Higher Order Component) that allows you to subscribe to the async queuer state.
16
15
  *
@@ -97,7 +96,7 @@ interface PreactAsyncQueuer<TValue, TSelected = {}> extends Omit<AsyncQueuer<TVa
97
96
  * - `lastResult`: The result from the most recent task execution
98
97
  * - `pendingTick`: Whether the queuer has a pending timeout for processing the next item
99
98
  * - `rejectionCount`: Number of items that have been rejected from being added
100
- * - `settledCount`: Number of task executions that have completed (success or error)
99
+ * - `settleCount`: Number of task executions that have completed (success or error)
101
100
  * - `size`: Number of items currently in the queue
102
101
  * - `status`: Current processing status ('idle' | 'running' | 'stopped')
103
102
  * - `successCount`: Number of task executions that have completed successfully
@@ -179,7 +178,7 @@ interface PreactAsyncQueuer<TValue, TSelected = {}> extends Omit<AsyncQueuer<TVa
179
178
  * (state) => ({
180
179
  * successCount: state.successCount,
181
180
  * errorCount: state.errorCount,
182
- * settledCount: state.settledCount,
181
+ * settleCount: state.settleCount,
183
182
  * expirationCount: state.expirationCount,
184
183
  * rejectionCount: state.rejectionCount
185
184
  * })
@@ -218,7 +217,5 @@ interface PreactAsyncQueuer<TValue, TSelected = {}> extends Omit<AsyncQueuer<TVa
218
217
  * const { size, isRunning, activeItems } = asyncQueuer.state;
219
218
  * ```
220
219
  */
221
- declare function useAsyncQueuer<TValue, TSelected = {}>(fn: (value: TValue) => Promise<any>, options?: PreactAsyncQueuerOptions<TValue, TSelected>, selector?: (state: AsyncQueuerState<TValue>) => TSelected): PreactAsyncQueuer<TValue, TSelected>;
222
- //#endregion
223
- export { PreactAsyncQueuer, PreactAsyncQueuerOptions, useAsyncQueuer };
224
- //# sourceMappingURL=useAsyncQueuer.d.ts.map
220
+ export declare function useAsyncQueuer<TValue, TSelected = {}>(fn: (value: TValue) => Promise<any>, options?: PreactAsyncQueuerOptions<TValue, TSelected>, selector?: (state: AsyncQueuerState<TValue>) => TSelected): PreactAsyncQueuer<TValue, TSelected>;
221
+ //#endregion
@@ -60,7 +60,7 @@ import { AsyncQueuer } from "@tanstack/pacer/async-queuer";
60
60
  * - `lastResult`: The result from the most recent task execution
61
61
  * - `pendingTick`: Whether the queuer has a pending timeout for processing the next item
62
62
  * - `rejectionCount`: Number of items that have been rejected from being added
63
- * - `settledCount`: Number of task executions that have completed (success or error)
63
+ * - `settleCount`: Number of task executions that have completed (success or error)
64
64
  * - `size`: Number of items currently in the queue
65
65
  * - `status`: Current processing status ('idle' | 'running' | 'stopped')
66
66
  * - `successCount`: Number of task executions that have completed successfully
@@ -142,7 +142,7 @@ import { AsyncQueuer } from "@tanstack/pacer/async-queuer";
142
142
  * (state) => ({
143
143
  * successCount: state.successCount,
144
144
  * errorCount: state.errorCount,
145
- * settledCount: state.settledCount,
145
+ * settleCount: state.settleCount,
146
146
  * expirationCount: state.expirationCount,
147
147
  * rejectionCount: state.rejectionCount
148
148
  * })
@@ -213,5 +213,4 @@ function useAsyncQueuer(fn, options = {}, selector = () => ({})) {
213
213
  }
214
214
 
215
215
  //#endregion
216
- export { useAsyncQueuer };
217
- //# sourceMappingURL=useAsyncQueuer.js.map
216
+ export { useAsyncQueuer };
@@ -1,6 +1,5 @@
1
1
  import { PreactAsyncRateLimiterOptions } from "./useAsyncRateLimiter.js";
2
2
  import { AnyAsyncFunction } from "@tanstack/pacer/types";
3
-
4
3
  //#region src/async-rate-limiter/useAsyncRateLimitedCallback.d.ts
5
4
  /**
6
5
  * A Preact hook that creates a rate-limited version of an async callback function.
@@ -55,7 +54,5 @@ import { AnyAsyncFunction } from "@tanstack/pacer/types";
55
54
  * );
56
55
  * ```
57
56
  */
58
- declare function useAsyncRateLimitedCallback<TFn extends AnyAsyncFunction>(fn: TFn, options: PreactAsyncRateLimiterOptions<TFn, {}>): (...args: Parameters<TFn>) => Promise<ReturnType<TFn>>;
59
- //#endregion
60
- export { useAsyncRateLimitedCallback };
61
- //# sourceMappingURL=useAsyncRateLimitedCallback.d.ts.map
57
+ export declare function useAsyncRateLimitedCallback<TFn extends AnyAsyncFunction>(fn: TFn, options: PreactAsyncRateLimiterOptions<TFn, {}>): (...args: Parameters<TFn>) => Promise<Awaited<ReturnType<TFn>> | undefined>;
58
+ //#endregion
@@ -61,5 +61,4 @@ function useAsyncRateLimitedCallback(fn, options) {
61
61
  }
62
62
 
63
63
  //#endregion
64
- export { useAsyncRateLimitedCallback };
65
- //# sourceMappingURL=useAsyncRateLimitedCallback.js.map
64
+ export { useAsyncRateLimitedCallback };
@@ -2,16 +2,15 @@ import { ComponentChildren } from "preact";
2
2
  import { Store } from "@tanstack/preact-store";
3
3
  import { AsyncRateLimiter, AsyncRateLimiterOptions, AsyncRateLimiterState } from "@tanstack/pacer/async-rate-limiter";
4
4
  import { AnyAsyncFunction } from "@tanstack/pacer/types";
5
-
6
5
  //#region src/async-rate-limiter/useAsyncRateLimiter.d.ts
7
- interface PreactAsyncRateLimiterOptions<TFn extends AnyAsyncFunction, TSelected = {}> extends AsyncRateLimiterOptions<TFn> {
6
+ export interface PreactAsyncRateLimiterOptions<TFn extends AnyAsyncFunction, TSelected = {}> extends AsyncRateLimiterOptions<TFn> {
8
7
  /**
9
8
  * Optional callback invoked when the component unmounts. Receives the rate limiter instance.
10
9
  * When provided, replaces the default cleanup (abort); use it to call reset(), add logging, etc.
11
10
  */
12
11
  onUnmount?: (rateLimiter: PreactAsyncRateLimiter<TFn, TSelected>) => void;
13
12
  }
14
- interface PreactAsyncRateLimiter<TFn extends AnyAsyncFunction, TSelected = {}> extends Omit<AsyncRateLimiter<TFn>, 'store'> {
13
+ export interface PreactAsyncRateLimiter<TFn extends AnyAsyncFunction, TSelected = {}> extends Omit<AsyncRateLimiter<TFn>, 'store'> {
15
14
  /**
16
15
  * A Preact HOC (Higher Order Component) that allows you to subscribe to the async rate limiter state.
17
16
  *
@@ -214,7 +213,5 @@ interface PreactAsyncRateLimiter<TFn extends AnyAsyncFunction, TSelected = {}> e
214
213
  * const { isExecuting, lastResult, rejectionCount } = state;
215
214
  * ```
216
215
  */
217
- declare function useAsyncRateLimiter<TFn extends AnyAsyncFunction, TSelected = {}>(fn: TFn, options: PreactAsyncRateLimiterOptions<TFn, TSelected>, selector?: (state: AsyncRateLimiterState<TFn>) => TSelected): PreactAsyncRateLimiter<TFn, TSelected>;
218
- //#endregion
219
- export { PreactAsyncRateLimiter, PreactAsyncRateLimiterOptions, useAsyncRateLimiter };
220
- //# sourceMappingURL=useAsyncRateLimiter.d.ts.map
216
+ export declare function useAsyncRateLimiter<TFn extends AnyAsyncFunction, TSelected = {}>(fn: TFn, options: PreactAsyncRateLimiterOptions<TFn, TSelected>, selector?: (state: AsyncRateLimiterState<TFn>) => TSelected): PreactAsyncRateLimiter<TFn, TSelected>;
217
+ //#endregion
@@ -205,5 +205,4 @@ function useAsyncRateLimiter(fn, options, selector = () => ({})) {
205
205
  }
206
206
 
207
207
  //#endregion
208
- export { useAsyncRateLimiter };
209
- //# sourceMappingURL=useAsyncRateLimiter.js.map
208
+ export { useAsyncRateLimiter };
@@ -1,6 +1,5 @@
1
1
  import { PreactAsyncThrottlerOptions } from "./useAsyncThrottler.js";
2
2
  import { AnyAsyncFunction } from "@tanstack/pacer/types";
3
-
4
3
  //#region src/async-throttler/useAsyncThrottledCallback.d.ts
5
4
  /**
6
5
  * A Preact hook that creates a throttled version of an async callback function.
@@ -8,10 +7,11 @@ import { AnyAsyncFunction } from "@tanstack/pacer/types";
8
7
  * providing a stable, throttled async function reference for use in Preact components.
9
8
  *
10
9
  * The throttled async function will execute at most once within the specified wait time period,
11
- * regardless of how many times it is called. If called multiple times during the wait period,
12
- * only the first invocation will execute, and subsequent calls will be ignored until
13
- * the wait period has elapsed. The returned function always returns a promise
14
- * that resolves or rejects with the result of the original async function.
10
+ * regardless of how many times it is called. Calls made during the wait period reschedule a
11
+ * single trailing execution with the latest arguments when `trailing` is enabled (the default).
12
+ * The most recent call's promise resolves or rejects with the trailing execution's result;
13
+ * each earlier call's promise resolves immediately with the most recent previous result (or
14
+ * `undefined` if nothing has executed yet), as does every call when the throttler is disabled.
15
15
  *
16
16
  * This hook provides a simpler API compared to `useAsyncThrottler`, making it ideal for basic
17
17
  * async throttling needs. However, it does not expose the underlying AsyncThrottler instance.
@@ -38,7 +38,5 @@ import { AnyAsyncFunction } from "@tanstack/pacer/types";
38
38
  * <button onClick={() => handleApiCall(formData)}>Send</button>
39
39
  * ```
40
40
  */
41
- declare function useAsyncThrottledCallback<TFn extends AnyAsyncFunction>(fn: TFn, options: PreactAsyncThrottlerOptions<TFn, {}>): (...args: Parameters<TFn>) => Promise<ReturnType<TFn>>;
42
- //#endregion
43
- export { useAsyncThrottledCallback };
44
- //# sourceMappingURL=useAsyncThrottledCallback.d.ts.map
41
+ export declare function useAsyncThrottledCallback<TFn extends AnyAsyncFunction>(fn: TFn, options: PreactAsyncThrottlerOptions<TFn, {}>): (...args: Parameters<TFn>) => Promise<Awaited<ReturnType<TFn>> | undefined>;
42
+ //#endregion
@@ -8,10 +8,11 @@ import { useCallback } from "preact/hooks";
8
8
  * providing a stable, throttled async function reference for use in Preact components.
9
9
  *
10
10
  * The throttled async function will execute at most once within the specified wait time period,
11
- * regardless of how many times it is called. If called multiple times during the wait period,
12
- * only the first invocation will execute, and subsequent calls will be ignored until
13
- * the wait period has elapsed. The returned function always returns a promise
14
- * that resolves or rejects with the result of the original async function.
11
+ * regardless of how many times it is called. Calls made during the wait period reschedule a
12
+ * single trailing execution with the latest arguments when `trailing` is enabled (the default).
13
+ * The most recent call's promise resolves or rejects with the trailing execution's result;
14
+ * each earlier call's promise resolves immediately with the most recent previous result (or
15
+ * `undefined` if nothing has executed yet), as does every call when the throttler is disabled.
15
16
  *
16
17
  * This hook provides a simpler API compared to `useAsyncThrottler`, making it ideal for basic
17
18
  * async throttling needs. However, it does not expose the underlying AsyncThrottler instance.
@@ -44,5 +45,4 @@ function useAsyncThrottledCallback(fn, options) {
44
45
  }
45
46
 
46
47
  //#endregion
47
- export { useAsyncThrottledCallback };
48
- //# sourceMappingURL=useAsyncThrottledCallback.js.map
48
+ export { useAsyncThrottledCallback };
@@ -2,16 +2,15 @@ import { ComponentChildren } from "preact";
2
2
  import { Store } from "@tanstack/preact-store";
3
3
  import { AsyncThrottler, AsyncThrottlerOptions, AsyncThrottlerState } from "@tanstack/pacer/async-throttler";
4
4
  import { AnyAsyncFunction } from "@tanstack/pacer/types";
5
-
6
5
  //#region src/async-throttler/useAsyncThrottler.d.ts
7
- interface PreactAsyncThrottlerOptions<TFn extends AnyAsyncFunction, TSelected = {}> extends AsyncThrottlerOptions<TFn> {
6
+ export interface PreactAsyncThrottlerOptions<TFn extends AnyAsyncFunction, TSelected = {}> extends AsyncThrottlerOptions<TFn> {
8
7
  /**
9
8
  * Optional callback invoked when the component unmounts. Receives the throttler instance.
10
9
  * When provided, replaces the default cleanup (cancel + abort); use it to call flush(), reset(), cancel(), add logging, etc.
11
10
  */
12
11
  onUnmount?: (throttler: PreactAsyncThrottler<TFn, TSelected>) => void;
13
12
  }
14
- interface PreactAsyncThrottler<TFn extends AnyAsyncFunction, TSelected = {}> extends Omit<AsyncThrottler<TFn>, 'store'> {
13
+ export interface PreactAsyncThrottler<TFn extends AnyAsyncFunction, TSelected = {}> extends Omit<AsyncThrottler<TFn>, 'store'> {
15
14
  /**
16
15
  * A Preact HOC (Higher Order Component) that allows you to subscribe to the async throttler state.
17
16
  *
@@ -208,7 +207,5 @@ interface PreactAsyncThrottler<TFn extends AnyAsyncFunction, TSelected = {}> ext
208
207
  * const { isExecuting, lastResult } = state;
209
208
  * ```
210
209
  */
211
- declare function useAsyncThrottler<TFn extends AnyAsyncFunction, TSelected = {}>(fn: TFn, options: PreactAsyncThrottlerOptions<TFn, TSelected>, selector?: (state: AsyncThrottlerState<TFn>) => TSelected): PreactAsyncThrottler<TFn, TSelected>;
212
- //#endregion
213
- export { PreactAsyncThrottler, PreactAsyncThrottlerOptions, useAsyncThrottler };
214
- //# sourceMappingURL=useAsyncThrottler.d.ts.map
210
+ export declare function useAsyncThrottler<TFn extends AnyAsyncFunction, TSelected = {}>(fn: TFn, options: PreactAsyncThrottlerOptions<TFn, TSelected>, selector?: (state: AsyncThrottlerState<TFn>) => TSelected): PreactAsyncThrottler<TFn, TSelected>;
211
+ //#endregion
@@ -202,5 +202,4 @@ function useAsyncThrottler(fn, options, selector = () => ({})) {
202
202
  }
203
203
 
204
204
  //#endregion
205
- export { useAsyncThrottler };
206
- //# sourceMappingURL=useAsyncThrottler.js.map
205
+ export { useAsyncThrottler };
@@ -1,5 +1,4 @@
1
1
  import { PreactBatcherOptions } from "./useBatcher.js";
2
-
3
2
  //#region src/batcher/useBatchedCallback.d.ts
4
3
  /**
5
4
  * A Preact hook that creates a batched version of a callback function.
@@ -36,7 +35,5 @@ import { PreactBatcherOptions } from "./useBatcher.js";
36
35
  * </button>
37
36
  * ```
38
37
  */
39
- declare function useBatchedCallback<TValue>(fn: (items: Array<TValue>) => void, options: PreactBatcherOptions<TValue, {}>): (item: TValue) => void;
40
- //#endregion
41
- export { useBatchedCallback };
42
- //# sourceMappingURL=useBatchedCallback.d.ts.map
38
+ export declare function useBatchedCallback<TValue>(fn: (items: Array<TValue>) => void, options: PreactBatcherOptions<TValue, {}>): (item: TValue) => void;
39
+ //#endregion
@@ -43,5 +43,4 @@ function useBatchedCallback(fn, options) {
43
43
  }
44
44
 
45
45
  //#endregion
46
- export { useBatchedCallback };
47
- //# sourceMappingURL=useBatchedCallback.js.map
46
+ export { useBatchedCallback };
@@ -1,16 +1,15 @@
1
1
  import { ComponentChildren } from "preact";
2
2
  import { Store } from "@tanstack/preact-store";
3
3
  import { Batcher, BatcherOptions, BatcherState } from "@tanstack/pacer/batcher";
4
-
5
4
  //#region src/batcher/useBatcher.d.ts
6
- interface PreactBatcherOptions<TValue, TSelected = {}> extends BatcherOptions<TValue> {
5
+ export interface PreactBatcherOptions<TValue, TSelected = {}> extends BatcherOptions<TValue> {
7
6
  /**
8
7
  * Optional callback invoked when the component unmounts. Receives the batcher instance.
9
8
  * When provided, replaces the default cleanup (cancel); use it to call flush(), reset(), cancel(), add logging, etc.
10
9
  */
11
10
  onUnmount?: (batcher: PreactBatcher<TValue, TSelected>) => void;
12
11
  }
13
- interface PreactBatcher<TValue, TSelected = {}> extends Omit<Batcher<TValue>, 'store'> {
12
+ export interface PreactBatcher<TValue, TSelected = {}> extends Omit<Batcher<TValue>, 'store'> {
14
13
  /**
15
14
  * A Preact HOC (Higher Order Component) that allows you to subscribe to the batcher state.
16
15
  *
@@ -78,7 +77,6 @@ interface PreactBatcher<TValue, TSelected = {}> extends Omit<Batcher<TValue>, 's
78
77
  * - `executionCount`: Number of batch executions that have been completed
79
78
  * - `isEmpty`: Whether the batcher has no items to process
80
79
  * - `isPending`: Whether the batcher is waiting for the timeout to trigger batch processing
81
- * - `isRunning`: Whether the batcher is active and will process items automatically
82
80
  * - `items`: Array of items currently queued for batch processing
83
81
  * - `size`: Number of items currently in the batch queue
84
82
  * - `status`: Current processing status ('idle' | 'pending')
@@ -138,7 +136,6 @@ interface PreactBatcher<TValue, TSelected = {}> extends Omit<Batcher<TValue>, 's
138
136
  * { maxSize: 5, wait: 2000 },
139
137
  * (state) => ({
140
138
  * isPending: state.isPending,
141
- * isRunning: state.isRunning,
142
139
  * status: state.status
143
140
  * })
144
141
  * );
@@ -162,14 +159,12 @@ interface PreactBatcher<TValue, TSelected = {}> extends Omit<Batcher<TValue>, 's
162
159
  * batcher.addItem(3); // Triggers batch processing
163
160
  *
164
161
  * // Control the batcher
165
- * batcher.stop(); // Pause batching
166
- * batcher.start(); // Resume batching
162
+ * batcher.cancel(); // Cancel the pending timer; queued items are retained
163
+ * batcher.flush(); // Process queued items immediately
167
164
  *
168
165
  * // Access the selected state (will be empty object {} unless selector provided)
169
166
  * const { size, isPending } = batcher.state;
170
167
  * ```
171
168
  */
172
- declare function useBatcher<TValue, TSelected = {}>(fn: (items: Array<TValue>) => void, options?: PreactBatcherOptions<TValue, TSelected>, selector?: (state: BatcherState<TValue>) => TSelected): PreactBatcher<TValue, TSelected>;
173
- //#endregion
174
- export { PreactBatcher, PreactBatcherOptions, useBatcher };
175
- //# sourceMappingURL=useBatcher.d.ts.map
169
+ export declare function useBatcher<TValue, TSelected = {}>(fn: (items: Array<TValue>) => void, options?: PreactBatcherOptions<TValue, TSelected>, selector?: (state: BatcherState<TValue>) => TSelected): PreactBatcher<TValue, TSelected>;
170
+ //#endregion
@@ -41,7 +41,6 @@ import { Batcher } from "@tanstack/pacer/batcher";
41
41
  * - `executionCount`: Number of batch executions that have been completed
42
42
  * - `isEmpty`: Whether the batcher has no items to process
43
43
  * - `isPending`: Whether the batcher is waiting for the timeout to trigger batch processing
44
- * - `isRunning`: Whether the batcher is active and will process items automatically
45
44
  * - `items`: Array of items currently queued for batch processing
46
45
  * - `size`: Number of items currently in the batch queue
47
46
  * - `status`: Current processing status ('idle' | 'pending')
@@ -101,7 +100,6 @@ import { Batcher } from "@tanstack/pacer/batcher";
101
100
  * { maxSize: 5, wait: 2000 },
102
101
  * (state) => ({
103
102
  * isPending: state.isPending,
104
- * isRunning: state.isRunning,
105
103
  * status: state.status
106
104
  * })
107
105
  * );
@@ -125,8 +123,8 @@ import { Batcher } from "@tanstack/pacer/batcher";
125
123
  * batcher.addItem(3); // Triggers batch processing
126
124
  *
127
125
  * // Control the batcher
128
- * batcher.stop(); // Pause batching
129
- * batcher.start(); // Resume batching
126
+ * batcher.cancel(); // Cancel the pending timer; queued items are retained
127
+ * batcher.flush(); // Process queued items immediately
130
128
  *
131
129
  * // Access the selected state (will be empty object {} unless selector provided)
132
130
  * const { size, isPending } = batcher.state;
@@ -161,5 +159,4 @@ function useBatcher(fn, options = {}, selector = () => ({})) {
161
159
  }
162
160
 
163
161
  //#endregion
164
- export { useBatcher };
165
- //# sourceMappingURL=useBatcher.js.map
162
+ export { useBatcher };
@@ -1,6 +1,5 @@
1
1
  import { PreactDebouncerOptions } from "./useDebouncer.js";
2
2
  import { AnyFunction } from "@tanstack/pacer/types";
3
-
4
3
  //#region src/debouncer/useDebouncedCallback.d.ts
5
4
  /**
6
5
  * A Preact hook that creates a debounced version of a callback function.
@@ -38,7 +37,5 @@ import { AnyFunction } from "@tanstack/pacer/types";
38
37
  * />
39
38
  * ```
40
39
  */
41
- declare function useDebouncedCallback<TFn extends AnyFunction>(fn: TFn, options: PreactDebouncerOptions<TFn, {}>): (...args: Parameters<TFn>) => void;
42
- //#endregion
43
- export { useDebouncedCallback };
44
- //# sourceMappingURL=useDebouncedCallback.d.ts.map
40
+ export declare function useDebouncedCallback<TFn extends AnyFunction>(fn: TFn, options: PreactDebouncerOptions<TFn, {}>): (...args: Parameters<TFn>) => void;
41
+ //#endregion