@tanstack/preact-pacer 0.23.0 → 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.
- package/dist/async-batcher/useAsyncBatchedCallback.d.ts +2 -4
- package/dist/async-batcher/useAsyncBatchedCallback.js +1 -2
- package/dist/async-batcher/useAsyncBatcher.d.ts +4 -7
- package/dist/async-batcher/useAsyncBatcher.js +1 -3
- package/dist/async-debouncer/useAsyncDebouncedCallback.d.ts +2 -4
- package/dist/async-debouncer/useAsyncDebouncedCallback.js +1 -2
- package/dist/async-debouncer/useAsyncDebouncer.d.ts +4 -6
- package/dist/async-debouncer/useAsyncDebouncer.js +1 -2
- package/dist/async-queuer/useAsyncQueuedState.d.ts +4 -6
- package/dist/async-queuer/useAsyncQueuedState.js +3 -4
- package/dist/async-queuer/useAsyncQueuer.d.ts +6 -8
- package/dist/async-queuer/useAsyncQueuer.js +3 -4
- package/dist/async-rate-limiter/useAsyncRateLimitedCallback.d.ts +2 -4
- package/dist/async-rate-limiter/useAsyncRateLimitedCallback.js +1 -2
- package/dist/async-rate-limiter/useAsyncRateLimiter.d.ts +4 -6
- package/dist/async-rate-limiter/useAsyncRateLimiter.js +1 -2
- package/dist/async-throttler/useAsyncThrottledCallback.d.ts +2 -4
- package/dist/async-throttler/useAsyncThrottledCallback.js +1 -2
- package/dist/async-throttler/useAsyncThrottler.d.ts +4 -6
- package/dist/async-throttler/useAsyncThrottler.js +1 -2
- package/dist/batcher/useBatchedCallback.d.ts +2 -4
- package/dist/batcher/useBatchedCallback.js +1 -2
- package/dist/batcher/useBatcher.d.ts +6 -10
- package/dist/batcher/useBatcher.js +3 -6
- package/dist/debouncer/useDebouncedCallback.d.ts +2 -4
- package/dist/debouncer/useDebouncedCallback.js +1 -2
- package/dist/debouncer/useDebouncedState.d.ts +2 -4
- package/dist/debouncer/useDebouncedState.js +1 -2
- package/dist/debouncer/useDebouncedValue.d.ts +2 -4
- package/dist/debouncer/useDebouncedValue.js +1 -2
- package/dist/debouncer/useDebouncer.d.ts +4 -6
- package/dist/debouncer/useDebouncer.js +1 -2
- package/dist/provider/PacerProvider.d.ts +6 -8
- package/dist/provider/PacerProvider.js +1 -2
- package/dist/queuer/useQueuedState.d.ts +2 -4
- package/dist/queuer/useQueuedState.js +1 -2
- package/dist/queuer/useQueuedValue.d.ts +2 -4
- package/dist/queuer/useQueuedValue.js +1 -2
- package/dist/queuer/useQueuer.d.ts +4 -6
- package/dist/queuer/useQueuer.js +1 -2
- package/dist/rate-limiter/useRateLimitedCallback.d.ts +2 -4
- package/dist/rate-limiter/useRateLimitedCallback.js +1 -2
- package/dist/rate-limiter/useRateLimitedState.d.ts +2 -4
- package/dist/rate-limiter/useRateLimitedState.js +1 -2
- package/dist/rate-limiter/useRateLimitedValue.d.ts +2 -4
- package/dist/rate-limiter/useRateLimitedValue.js +1 -2
- package/dist/rate-limiter/useRateLimiter.d.ts +4 -6
- package/dist/rate-limiter/useRateLimiter.js +1 -2
- package/dist/throttler/useThrottledCallback.d.ts +2 -4
- package/dist/throttler/useThrottledCallback.js +1 -2
- package/dist/throttler/useThrottledState.d.ts +2 -4
- package/dist/throttler/useThrottledState.js +1 -2
- package/dist/throttler/useThrottledValue.d.ts +2 -4
- package/dist/throttler/useThrottledValue.js +1 -2
- package/dist/throttler/useThrottler.d.ts +4 -6
- package/dist/throttler/useThrottler.js +1 -2
- package/package.json +22 -70
- package/dist/async-batcher/index.cjs +0 -13
- package/dist/async-batcher/index.d.cts +0 -4
- package/dist/async-batcher/useAsyncBatchedCallback.cjs +0 -51
- package/dist/async-batcher/useAsyncBatchedCallback.cjs.map +0 -1
- package/dist/async-batcher/useAsyncBatchedCallback.d.cts +0 -43
- package/dist/async-batcher/useAsyncBatchedCallback.js.map +0 -1
- package/dist/async-batcher/useAsyncBatcher.cjs +0 -217
- package/dist/async-batcher/useAsyncBatcher.cjs.map +0 -1
- package/dist/async-batcher/useAsyncBatcher.d.cts +0 -223
- package/dist/async-batcher/useAsyncBatcher.js.map +0 -1
- package/dist/async-debouncer/index.cjs +0 -13
- package/dist/async-debouncer/index.d.cts +0 -4
- package/dist/async-debouncer/useAsyncDebouncedCallback.cjs +0 -52
- package/dist/async-debouncer/useAsyncDebouncedCallback.cjs.map +0 -1
- package/dist/async-debouncer/useAsyncDebouncedCallback.d.cts +0 -47
- package/dist/async-debouncer/useAsyncDebouncedCallback.js.map +0 -1
- package/dist/async-debouncer/useAsyncDebouncer.cjs +0 -195
- package/dist/async-debouncer/useAsyncDebouncer.cjs.map +0 -1
- package/dist/async-debouncer/useAsyncDebouncer.d.cts +0 -202
- package/dist/async-debouncer/useAsyncDebouncer.js.map +0 -1
- package/dist/async-queuer/index.cjs +0 -13
- package/dist/async-queuer/index.d.cts +0 -4
- package/dist/async-queuer/useAsyncQueuedState.cjs +0 -154
- package/dist/async-queuer/useAsyncQueuedState.cjs.map +0 -1
- package/dist/async-queuer/useAsyncQueuedState.d.cts +0 -150
- package/dist/async-queuer/useAsyncQueuedState.js.map +0 -1
- package/dist/async-queuer/useAsyncQueuer.cjs +0 -217
- package/dist/async-queuer/useAsyncQueuer.cjs.map +0 -1
- package/dist/async-queuer/useAsyncQueuer.d.cts +0 -223
- package/dist/async-queuer/useAsyncQueuer.js.map +0 -1
- package/dist/async-rate-limiter/index.cjs +0 -13
- package/dist/async-rate-limiter/index.d.cts +0 -4
- package/dist/async-rate-limiter/useAsyncRateLimitedCallback.cjs +0 -65
- package/dist/async-rate-limiter/useAsyncRateLimitedCallback.cjs.map +0 -1
- package/dist/async-rate-limiter/useAsyncRateLimitedCallback.d.cts +0 -60
- package/dist/async-rate-limiter/useAsyncRateLimitedCallback.js.map +0 -1
- package/dist/async-rate-limiter/useAsyncRateLimiter.cjs +0 -209
- package/dist/async-rate-limiter/useAsyncRateLimiter.cjs.map +0 -1
- package/dist/async-rate-limiter/useAsyncRateLimiter.d.cts +0 -219
- package/dist/async-rate-limiter/useAsyncRateLimiter.js.map +0 -1
- package/dist/async-retryer/index.cjs +0 -8
- package/dist/async-retryer/index.d.cts +0 -1
- package/dist/async-throttler/index.cjs +0 -13
- package/dist/async-throttler/index.d.cts +0 -4
- package/dist/async-throttler/useAsyncThrottledCallback.cjs +0 -49
- package/dist/async-throttler/useAsyncThrottledCallback.cjs.map +0 -1
- package/dist/async-throttler/useAsyncThrottledCallback.d.cts +0 -44
- package/dist/async-throttler/useAsyncThrottledCallback.js.map +0 -1
- package/dist/async-throttler/useAsyncThrottler.cjs +0 -206
- package/dist/async-throttler/useAsyncThrottler.cjs.map +0 -1
- package/dist/async-throttler/useAsyncThrottler.d.cts +0 -213
- package/dist/async-throttler/useAsyncThrottler.js.map +0 -1
- package/dist/batcher/index.cjs +0 -13
- package/dist/batcher/index.d.cts +0 -4
- package/dist/batcher/useBatchedCallback.cjs +0 -47
- package/dist/batcher/useBatchedCallback.cjs.map +0 -1
- package/dist/batcher/useBatchedCallback.d.cts +0 -41
- package/dist/batcher/useBatchedCallback.js.map +0 -1
- package/dist/batcher/useBatcher.cjs +0 -165
- package/dist/batcher/useBatcher.cjs.map +0 -1
- package/dist/batcher/useBatcher.d.cts +0 -174
- package/dist/batcher/useBatcher.js.map +0 -1
- package/dist/debouncer/index.cjs +0 -17
- package/dist/debouncer/index.d.cts +0 -6
- package/dist/debouncer/useDebouncedCallback.cjs +0 -48
- package/dist/debouncer/useDebouncedCallback.cjs.map +0 -1
- package/dist/debouncer/useDebouncedCallback.d.cts +0 -43
- package/dist/debouncer/useDebouncedCallback.js.map +0 -1
- package/dist/debouncer/useDebouncedState.cjs +0 -89
- package/dist/debouncer/useDebouncedState.cjs.map +0 -1
- package/dist/debouncer/useDebouncedState.d.cts +0 -80
- package/dist/debouncer/useDebouncedState.js.map +0 -1
- package/dist/debouncer/useDebouncedValue.cjs +0 -96
- package/dist/debouncer/useDebouncedValue.cjs.map +0 -1
- package/dist/debouncer/useDebouncedValue.d.cts +0 -89
- package/dist/debouncer/useDebouncedValue.js.map +0 -1
- package/dist/debouncer/useDebouncer.cjs +0 -141
- package/dist/debouncer/useDebouncer.cjs.map +0 -1
- package/dist/debouncer/useDebouncer.d.cts +0 -151
- package/dist/debouncer/useDebouncer.js.map +0 -1
- package/dist/index.cjs +0 -67
- package/dist/index.d.cts +0 -30
- package/dist/provider/PacerProvider.cjs +0 -26
- package/dist/provider/PacerProvider.cjs.map +0 -1
- package/dist/provider/PacerProvider.d.cts +0 -28
- package/dist/provider/PacerProvider.js.map +0 -1
- package/dist/provider/index.cjs +0 -6
- package/dist/provider/index.d.cts +0 -2
- package/dist/queuer/index.cjs +0 -15
- package/dist/queuer/index.d.cts +0 -5
- package/dist/queuer/useQueuedState.cjs +0 -129
- package/dist/queuer/useQueuedState.cjs.map +0 -1
- package/dist/queuer/useQueuedState.d.cts +0 -121
- package/dist/queuer/useQueuedState.js.map +0 -1
- package/dist/queuer/useQueuedValue.cjs +0 -115
- package/dist/queuer/useQueuedValue.cjs.map +0 -1
- package/dist/queuer/useQueuedValue.d.cts +0 -104
- package/dist/queuer/useQueuedValue.js.map +0 -1
- package/dist/queuer/useQueuer.cjs +0 -176
- package/dist/queuer/useQueuer.cjs.map +0 -1
- package/dist/queuer/useQueuer.d.cts +0 -185
- package/dist/queuer/useQueuer.js.map +0 -1
- package/dist/rate-limiter/index.cjs +0 -17
- package/dist/rate-limiter/index.d.cts +0 -6
- package/dist/rate-limiter/useRateLimitedCallback.cjs +0 -65
- package/dist/rate-limiter/useRateLimitedCallback.cjs.map +0 -1
- package/dist/rate-limiter/useRateLimitedCallback.d.cts +0 -60
- package/dist/rate-limiter/useRateLimitedCallback.js.map +0 -1
- package/dist/rate-limiter/useRateLimitedState.cjs +0 -115
- package/dist/rate-limiter/useRateLimitedState.cjs.map +0 -1
- package/dist/rate-limiter/useRateLimitedState.d.cts +0 -106
- package/dist/rate-limiter/useRateLimitedState.js.map +0 -1
- package/dist/rate-limiter/useRateLimitedValue.cjs +0 -102
- package/dist/rate-limiter/useRateLimitedValue.cjs.map +0 -1
- package/dist/rate-limiter/useRateLimitedValue.d.cts +0 -95
- package/dist/rate-limiter/useRateLimitedValue.js.map +0 -1
- package/dist/rate-limiter/useRateLimiter.cjs +0 -167
- package/dist/rate-limiter/useRateLimiter.cjs.map +0 -1
- package/dist/rate-limiter/useRateLimiter.d.cts +0 -178
- package/dist/rate-limiter/useRateLimiter.js.map +0 -1
- package/dist/throttler/index.cjs +0 -17
- package/dist/throttler/index.d.cts +0 -6
- package/dist/throttler/useThrottledCallback.cjs +0 -49
- package/dist/throttler/useThrottledCallback.cjs.map +0 -1
- package/dist/throttler/useThrottledCallback.d.cts +0 -44
- package/dist/throttler/useThrottledCallback.js.map +0 -1
- package/dist/throttler/useThrottledState.cjs +0 -100
- package/dist/throttler/useThrottledState.cjs.map +0 -1
- package/dist/throttler/useThrottledState.d.cts +0 -91
- package/dist/throttler/useThrottledState.js.map +0 -1
- package/dist/throttler/useThrottledValue.cjs +0 -91
- package/dist/throttler/useThrottledValue.cjs.map +0 -1
- package/dist/throttler/useThrottledValue.d.cts +0 -84
- package/dist/throttler/useThrottledValue.js.map +0 -1
- package/dist/throttler/useThrottler.cjs +0 -146
- package/dist/throttler/useThrottler.cjs.map +0 -1
- package/dist/throttler/useThrottler.d.cts +0 -156
- package/dist/throttler/useThrottler.js.map +0 -1
- package/dist/types/index.cjs +0 -8
- package/dist/types/index.d.cts +0 -1
- package/dist/utils/index.cjs +0 -8
- package/dist/utils/index.d.cts +0 -1
- package/src/async-batcher/index.ts +0 -4
- package/src/async-batcher/useAsyncBatchedCallback.ts +0 -53
- package/src/async-batcher/useAsyncBatcher.ts +0 -293
- package/src/async-debouncer/index.ts +0 -5
- package/src/async-debouncer/useAsyncDebouncedCallback.ts +0 -55
- package/src/async-debouncer/useAsyncDebouncer.ts +0 -274
- package/src/async-queuer/index.ts +0 -4
- package/src/async-queuer/useAsyncQueuedState.ts +0 -165
- package/src/async-queuer/useAsyncQueuer.ts +0 -293
- package/src/async-rate-limiter/index.ts +0 -5
- package/src/async-rate-limiter/useAsyncRateLimitedCallback.ts +0 -68
- package/src/async-rate-limiter/useAsyncRateLimiter.ts +0 -294
- package/src/async-retryer/index.ts +0 -2
- package/src/async-throttler/index.ts +0 -5
- package/src/async-throttler/useAsyncThrottledCallback.ts +0 -52
- package/src/async-throttler/useAsyncThrottler.ts +0 -285
- package/src/batcher/index.ts +0 -4
- package/src/batcher/useBatchedCallback.ts +0 -46
- package/src/batcher/useBatcher.ts +0 -241
- package/src/debouncer/index.ts +0 -7
- package/src/debouncer/useDebouncedCallback.ts +0 -51
- package/src/debouncer/useDebouncedState.ts +0 -106
- package/src/debouncer/useDebouncedValue.ts +0 -109
- package/src/debouncer/useDebouncer.ts +0 -219
- package/src/index.ts +0 -56
- package/src/provider/PacerProvider.tsx +0 -70
- package/src/provider/index.ts +0 -1
- package/src/queuer/index.ts +0 -5
- package/src/queuer/useQueuedState.ts +0 -133
- package/src/queuer/useQueuedValue.ts +0 -129
- package/src/queuer/useQueuer.ts +0 -251
- package/src/rate-limiter/index.ts +0 -6
- package/src/rate-limiter/useRateLimitedCallback.ts +0 -68
- package/src/rate-limiter/useRateLimitedState.ts +0 -124
- package/src/rate-limiter/useRateLimitedValue.ts +0 -110
- package/src/rate-limiter/useRateLimiter.ts +0 -244
- package/src/throttler/index.ts +0 -7
- package/src/throttler/useThrottledCallback.ts +0 -52
- package/src/throttler/useThrottledState.ts +0 -118
- package/src/throttler/useThrottledValue.ts +0 -104
- package/src/throttler/useThrottler.ts +0 -224
- package/src/types/index.ts +0 -1
- package/src/utils/index.ts +0 -1
|
@@ -37,7 +37,5 @@ import { PreactAsyncBatcherOptions } from "./useAsyncBatcher.js";
|
|
|
37
37
|
* </button>
|
|
38
38
|
* ```
|
|
39
39
|
*/
|
|
40
|
-
declare function useAsyncBatchedCallback<TValue>(fn: (items: Array<TValue>) => Promise<unknown>, options: PreactAsyncBatcherOptions<TValue, {}>): (item: TValue) => Promise<void>;
|
|
41
|
-
//#endregion
|
|
42
|
-
export { useAsyncBatchedCallback };
|
|
43
|
-
//# 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
|
|
@@ -2,14 +2,14 @@ import { ComponentChildren } from "preact";
|
|
|
2
2
|
import { AsyncBatcher, AsyncBatcherOptions, AsyncBatcherState } from "@tanstack/pacer/async-batcher";
|
|
3
3
|
import { Store } from "@tanstack/preact-store";
|
|
4
4
|
//#region src/async-batcher/useAsyncBatcher.d.ts
|
|
5
|
-
interface PreactAsyncBatcherOptions<TValue, TSelected = {}> extends AsyncBatcherOptions<TValue> {
|
|
5
|
+
export interface PreactAsyncBatcherOptions<TValue, TSelected = {}> extends AsyncBatcherOptions<TValue> {
|
|
6
6
|
/**
|
|
7
7
|
* Optional callback invoked when the component unmounts. Receives the batcher instance.
|
|
8
8
|
* When provided, replaces the default cleanup (cancel + abort); use it to call flush(), reset(), cancel(), add logging, etc.
|
|
9
9
|
*/
|
|
10
10
|
onUnmount?: (batcher: PreactAsyncBatcher<TValue, TSelected>) => void;
|
|
11
11
|
}
|
|
12
|
-
interface PreactAsyncBatcher<TValue, TSelected = {}> extends Omit<AsyncBatcher<TValue>, 'store'> {
|
|
12
|
+
export interface PreactAsyncBatcher<TValue, TSelected = {}> extends Omit<AsyncBatcher<TValue>, 'store'> {
|
|
13
13
|
/**
|
|
14
14
|
* A Preact HOC (Higher Order Component) that allows you to subscribe to the async batcher state.
|
|
15
15
|
*
|
|
@@ -96,7 +96,6 @@ interface PreactAsyncBatcher<TValue, TSelected = {}> extends Omit<AsyncBatcher<T
|
|
|
96
96
|
* - `isEmpty`: Whether the batcher has no items to process
|
|
97
97
|
* - `isExecuting`: Whether a batch is currently being processed asynchronously
|
|
98
98
|
* - `isPending`: Whether the batcher is waiting for the timeout to trigger batch processing
|
|
99
|
-
* - `isRunning`: Whether the batcher is active and will process items automatically
|
|
100
99
|
* - `items`: Array of items currently queued for batch processing
|
|
101
100
|
* - `lastResult`: The result from the most recent batch execution
|
|
102
101
|
* - `settleCount`: Number of batch executions that have completed (success or error)
|
|
@@ -217,7 +216,5 @@ interface PreactAsyncBatcher<TValue, TSelected = {}> extends Omit<AsyncBatcher<T
|
|
|
217
216
|
* const { isExecuting, lastResult, size } = asyncBatcher.state;
|
|
218
217
|
* ```
|
|
219
218
|
*/
|
|
220
|
-
declare function useAsyncBatcher<TValue, TSelected = {}>(fn: (items: Array<TValue>) => Promise<any>, options?: PreactAsyncBatcherOptions<TValue, TSelected>, selector?: (state: AsyncBatcherState<TValue>) => TSelected): PreactAsyncBatcher<TValue, TSelected>;
|
|
221
|
-
//#endregion
|
|
222
|
-
export { PreactAsyncBatcher, PreactAsyncBatcherOptions, useAsyncBatcher };
|
|
223
|
-
//# 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 };
|
|
@@ -41,7 +41,5 @@ import { AnyAsyncFunction } from "@tanstack/pacer/types";
|
|
|
41
41
|
* />
|
|
42
42
|
* ```
|
|
43
43
|
*/
|
|
44
|
-
declare function useAsyncDebouncedCallback<TFn extends AnyAsyncFunction>(fn: TFn, options: PreactAsyncDebouncerOptions<TFn, {}>): (...args: Parameters<TFn>) => Promise<Awaited<ReturnType<TFn>> | undefined>;
|
|
45
|
-
//#endregion
|
|
46
|
-
export { useAsyncDebouncedCallback };
|
|
47
|
-
//# 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
|
|
@@ -3,14 +3,14 @@ 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
5
|
//#region src/async-debouncer/useAsyncDebouncer.d.ts
|
|
6
|
-
interface PreactAsyncDebouncerOptions<TFn extends AnyAsyncFunction, TSelected = {}> extends AsyncDebouncerOptions<TFn> {
|
|
6
|
+
export interface PreactAsyncDebouncerOptions<TFn extends AnyAsyncFunction, TSelected = {}> extends AsyncDebouncerOptions<TFn> {
|
|
7
7
|
/**
|
|
8
8
|
* Optional callback invoked when the component unmounts. Receives the debouncer instance.
|
|
9
9
|
* When provided, replaces the default cleanup (cancel + abort); use it to call flush(), reset(), cancel(), add logging, etc.
|
|
10
10
|
*/
|
|
11
11
|
onUnmount?: (debouncer: PreactAsyncDebouncer<TFn, TSelected>) => void;
|
|
12
12
|
}
|
|
13
|
-
interface PreactAsyncDebouncer<TFn extends AnyAsyncFunction, TSelected = {}> extends Omit<AsyncDebouncer<TFn>, 'store'> {
|
|
13
|
+
export interface PreactAsyncDebouncer<TFn extends AnyAsyncFunction, TSelected = {}> extends Omit<AsyncDebouncer<TFn>, 'store'> {
|
|
14
14
|
/**
|
|
15
15
|
* A Preact HOC (Higher Order Component) that allows you to subscribe to the async debouncer state.
|
|
16
16
|
*
|
|
@@ -196,7 +196,5 @@ interface PreactAsyncDebouncer<TFn extends AnyAsyncFunction, TSelected = {}> ext
|
|
|
196
196
|
* const { isExecuting, lastResult } = state;
|
|
197
197
|
* ```
|
|
198
198
|
*/
|
|
199
|
-
declare function useAsyncDebouncer<TFn extends AnyAsyncFunction, TSelected = {}>(fn: TFn, options: PreactAsyncDebouncerOptions<TFn, TSelected>, selector?: (state: AsyncDebouncerState<TFn>) => TSelected): PreactAsyncDebouncer<TFn, TSelected>;
|
|
200
|
-
//#endregion
|
|
201
|
-
export { PreactAsyncDebouncer, PreactAsyncDebouncerOptions, useAsyncDebouncer };
|
|
202
|
-
//# 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
|
|
@@ -45,7 +45,7 @@ import { AsyncQueuerState } from "@tanstack/pacer/async-queuer";
|
|
|
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
|
-
* - `
|
|
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 { AsyncQueuerState } from "@tanstack/pacer/async-queuer";
|
|
|
106
106
|
* (state) => ({
|
|
107
107
|
* successCount: state.successCount,
|
|
108
108
|
* errorCount: state.errorCount,
|
|
109
|
-
*
|
|
109
|
+
* settleCount: state.settleCount,
|
|
110
110
|
* expirationCount: state.expirationCount,
|
|
111
111
|
* rejectionCount: state.rejectionCount
|
|
112
112
|
* })
|
|
@@ -144,7 +144,5 @@ import { AsyncQueuerState } from "@tanstack/pacer/async-queuer";
|
|
|
144
144
|
* const { size, isRunning, activeItems } = asyncQueuer.state;
|
|
145
145
|
* ```
|
|
146
146
|
*/
|
|
147
|
-
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
|
|
149
|
-
export { useAsyncQueuedState };
|
|
150
|
-
//# 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
|
-
* - `
|
|
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
|
-
*
|
|
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 };
|
|
@@ -2,14 +2,14 @@ import { ComponentChildren } from "preact";
|
|
|
2
2
|
import { Store } from "@tanstack/preact-store";
|
|
3
3
|
import { AsyncQueuer, AsyncQueuerOptions, AsyncQueuerState } from "@tanstack/pacer/async-queuer";
|
|
4
4
|
//#region src/async-queuer/useAsyncQueuer.d.ts
|
|
5
|
-
interface PreactAsyncQueuerOptions<TValue, TSelected = {}> extends AsyncQueuerOptions<TValue> {
|
|
5
|
+
export interface PreactAsyncQueuerOptions<TValue, TSelected = {}> extends AsyncQueuerOptions<TValue> {
|
|
6
6
|
/**
|
|
7
7
|
* Optional callback invoked when the component unmounts. Receives the queuer instance.
|
|
8
8
|
* When provided, replaces the default cleanup (stop + abort); use it to call flush(), flushAsBatch(), stop(), add logging, etc.
|
|
9
9
|
*/
|
|
10
10
|
onUnmount?: (queuer: PreactAsyncQueuer<TValue, TSelected>) => void;
|
|
11
11
|
}
|
|
12
|
-
interface PreactAsyncQueuer<TValue, TSelected = {}> extends Omit<AsyncQueuer<TValue>, 'store'> {
|
|
12
|
+
export interface PreactAsyncQueuer<TValue, TSelected = {}> extends Omit<AsyncQueuer<TValue>, 'store'> {
|
|
13
13
|
/**
|
|
14
14
|
* A Preact HOC (Higher Order Component) that allows you to subscribe to the async queuer state.
|
|
15
15
|
*
|
|
@@ -96,7 +96,7 @@ interface PreactAsyncQueuer<TValue, TSelected = {}> extends Omit<AsyncQueuer<TVa
|
|
|
96
96
|
* - `lastResult`: The result from the most recent task execution
|
|
97
97
|
* - `pendingTick`: Whether the queuer has a pending timeout for processing the next item
|
|
98
98
|
* - `rejectionCount`: Number of items that have been rejected from being added
|
|
99
|
-
* - `
|
|
99
|
+
* - `settleCount`: Number of task executions that have completed (success or error)
|
|
100
100
|
* - `size`: Number of items currently in the queue
|
|
101
101
|
* - `status`: Current processing status ('idle' | 'running' | 'stopped')
|
|
102
102
|
* - `successCount`: Number of task executions that have completed successfully
|
|
@@ -178,7 +178,7 @@ interface PreactAsyncQueuer<TValue, TSelected = {}> extends Omit<AsyncQueuer<TVa
|
|
|
178
178
|
* (state) => ({
|
|
179
179
|
* successCount: state.successCount,
|
|
180
180
|
* errorCount: state.errorCount,
|
|
181
|
-
*
|
|
181
|
+
* settleCount: state.settleCount,
|
|
182
182
|
* expirationCount: state.expirationCount,
|
|
183
183
|
* rejectionCount: state.rejectionCount
|
|
184
184
|
* })
|
|
@@ -217,7 +217,5 @@ interface PreactAsyncQueuer<TValue, TSelected = {}> extends Omit<AsyncQueuer<TVa
|
|
|
217
217
|
* const { size, isRunning, activeItems } = asyncQueuer.state;
|
|
218
218
|
* ```
|
|
219
219
|
*/
|
|
220
|
-
declare function useAsyncQueuer<TValue, TSelected = {}>(fn: (value: TValue) => Promise<any>, options?: PreactAsyncQueuerOptions<TValue, TSelected>, selector?: (state: AsyncQueuerState<TValue>) => TSelected): PreactAsyncQueuer<TValue, TSelected>;
|
|
221
|
-
//#endregion
|
|
222
|
-
export { PreactAsyncQueuer, PreactAsyncQueuerOptions, useAsyncQueuer };
|
|
223
|
-
//# 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
|
-
* - `
|
|
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
|
-
*
|
|
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 };
|
|
@@ -54,7 +54,5 @@ import { AnyAsyncFunction } from "@tanstack/pacer/types";
|
|
|
54
54
|
* );
|
|
55
55
|
* ```
|
|
56
56
|
*/
|
|
57
|
-
declare function useAsyncRateLimitedCallback<TFn extends AnyAsyncFunction>(fn: TFn, options: PreactAsyncRateLimiterOptions<TFn, {}>): (...args: Parameters<TFn>) => Promise<Awaited<ReturnType<TFn>> | undefined>;
|
|
58
|
-
//#endregion
|
|
59
|
-
export { useAsyncRateLimitedCallback };
|
|
60
|
-
//# 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
|
|
@@ -3,14 +3,14 @@ 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
5
|
//#region src/async-rate-limiter/useAsyncRateLimiter.d.ts
|
|
6
|
-
interface PreactAsyncRateLimiterOptions<TFn extends AnyAsyncFunction, TSelected = {}> extends AsyncRateLimiterOptions<TFn> {
|
|
6
|
+
export interface PreactAsyncRateLimiterOptions<TFn extends AnyAsyncFunction, TSelected = {}> extends AsyncRateLimiterOptions<TFn> {
|
|
7
7
|
/**
|
|
8
8
|
* Optional callback invoked when the component unmounts. Receives the rate limiter instance.
|
|
9
9
|
* When provided, replaces the default cleanup (abort); use it to call reset(), add logging, etc.
|
|
10
10
|
*/
|
|
11
11
|
onUnmount?: (rateLimiter: PreactAsyncRateLimiter<TFn, TSelected>) => void;
|
|
12
12
|
}
|
|
13
|
-
interface PreactAsyncRateLimiter<TFn extends AnyAsyncFunction, TSelected = {}> extends Omit<AsyncRateLimiter<TFn>, 'store'> {
|
|
13
|
+
export interface PreactAsyncRateLimiter<TFn extends AnyAsyncFunction, TSelected = {}> extends Omit<AsyncRateLimiter<TFn>, 'store'> {
|
|
14
14
|
/**
|
|
15
15
|
* A Preact HOC (Higher Order Component) that allows you to subscribe to the async rate limiter state.
|
|
16
16
|
*
|
|
@@ -213,7 +213,5 @@ interface PreactAsyncRateLimiter<TFn extends AnyAsyncFunction, TSelected = {}> e
|
|
|
213
213
|
* const { isExecuting, lastResult, rejectionCount } = state;
|
|
214
214
|
* ```
|
|
215
215
|
*/
|
|
216
|
-
declare function useAsyncRateLimiter<TFn extends AnyAsyncFunction, TSelected = {}>(fn: TFn, options: PreactAsyncRateLimiterOptions<TFn, TSelected>, selector?: (state: AsyncRateLimiterState<TFn>) => TSelected): PreactAsyncRateLimiter<TFn, TSelected>;
|
|
217
|
-
//#endregion
|
|
218
|
-
export { PreactAsyncRateLimiter, PreactAsyncRateLimiterOptions, useAsyncRateLimiter };
|
|
219
|
-
//# 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
|
|
@@ -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<Awaited<ReturnType<TFn>> | undefined>;
|
|
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
|
|
@@ -3,14 +3,14 @@ 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
5
|
//#region src/async-throttler/useAsyncThrottler.d.ts
|
|
6
|
-
interface PreactAsyncThrottlerOptions<TFn extends AnyAsyncFunction, TSelected = {}> extends AsyncThrottlerOptions<TFn> {
|
|
6
|
+
export interface PreactAsyncThrottlerOptions<TFn extends AnyAsyncFunction, TSelected = {}> extends AsyncThrottlerOptions<TFn> {
|
|
7
7
|
/**
|
|
8
8
|
* Optional callback invoked when the component unmounts. Receives the throttler instance.
|
|
9
9
|
* When provided, replaces the default cleanup (cancel + abort); use it to call flush(), reset(), cancel(), add logging, etc.
|
|
10
10
|
*/
|
|
11
11
|
onUnmount?: (throttler: PreactAsyncThrottler<TFn, TSelected>) => void;
|
|
12
12
|
}
|
|
13
|
-
interface PreactAsyncThrottler<TFn extends AnyAsyncFunction, TSelected = {}> extends Omit<AsyncThrottler<TFn>, 'store'> {
|
|
13
|
+
export interface PreactAsyncThrottler<TFn extends AnyAsyncFunction, TSelected = {}> extends Omit<AsyncThrottler<TFn>, 'store'> {
|
|
14
14
|
/**
|
|
15
15
|
* A Preact HOC (Higher Order Component) that allows you to subscribe to the async throttler state.
|
|
16
16
|
*
|
|
@@ -207,7 +207,5 @@ interface PreactAsyncThrottler<TFn extends AnyAsyncFunction, TSelected = {}> ext
|
|
|
207
207
|
* const { isExecuting, lastResult } = state;
|
|
208
208
|
* ```
|
|
209
209
|
*/
|
|
210
|
-
declare function useAsyncThrottler<TFn extends AnyAsyncFunction, TSelected = {}>(fn: TFn, options: PreactAsyncThrottlerOptions<TFn, TSelected>, selector?: (state: AsyncThrottlerState<TFn>) => TSelected): PreactAsyncThrottler<TFn, TSelected>;
|
|
211
|
-
//#endregion
|
|
212
|
-
export { PreactAsyncThrottler, PreactAsyncThrottlerOptions, useAsyncThrottler };
|
|
213
|
-
//# 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
|
|
@@ -35,7 +35,5 @@ import { PreactBatcherOptions } from "./useBatcher.js";
|
|
|
35
35
|
* </button>
|
|
36
36
|
* ```
|
|
37
37
|
*/
|
|
38
|
-
declare function useBatchedCallback<TValue>(fn: (items: Array<TValue>) => void, options: PreactBatcherOptions<TValue, {}>): (item: TValue) => void;
|
|
39
|
-
//#endregion
|
|
40
|
-
export { useBatchedCallback };
|
|
41
|
-
//# sourceMappingURL=useBatchedCallback.d.ts.map
|
|
38
|
+
export declare function useBatchedCallback<TValue>(fn: (items: Array<TValue>) => void, options: PreactBatcherOptions<TValue, {}>): (item: TValue) => void;
|
|
39
|
+
//#endregion
|
|
@@ -2,14 +2,14 @@ import { ComponentChildren } from "preact";
|
|
|
2
2
|
import { Store } from "@tanstack/preact-store";
|
|
3
3
|
import { Batcher, BatcherOptions, BatcherState } from "@tanstack/pacer/batcher";
|
|
4
4
|
//#region src/batcher/useBatcher.d.ts
|
|
5
|
-
interface PreactBatcherOptions<TValue, TSelected = {}> extends BatcherOptions<TValue> {
|
|
5
|
+
export interface PreactBatcherOptions<TValue, TSelected = {}> extends BatcherOptions<TValue> {
|
|
6
6
|
/**
|
|
7
7
|
* Optional callback invoked when the component unmounts. Receives the batcher instance.
|
|
8
8
|
* When provided, replaces the default cleanup (cancel); use it to call flush(), reset(), cancel(), add logging, etc.
|
|
9
9
|
*/
|
|
10
10
|
onUnmount?: (batcher: PreactBatcher<TValue, TSelected>) => void;
|
|
11
11
|
}
|
|
12
|
-
interface PreactBatcher<TValue, TSelected = {}> extends Omit<Batcher<TValue>, 'store'> {
|
|
12
|
+
export interface PreactBatcher<TValue, TSelected = {}> extends Omit<Batcher<TValue>, 'store'> {
|
|
13
13
|
/**
|
|
14
14
|
* A Preact HOC (Higher Order Component) that allows you to subscribe to the batcher state.
|
|
15
15
|
*
|
|
@@ -77,7 +77,6 @@ interface PreactBatcher<TValue, TSelected = {}> extends Omit<Batcher<TValue>, 's
|
|
|
77
77
|
* - `executionCount`: Number of batch executions that have been completed
|
|
78
78
|
* - `isEmpty`: Whether the batcher has no items to process
|
|
79
79
|
* - `isPending`: Whether the batcher is waiting for the timeout to trigger batch processing
|
|
80
|
-
* - `isRunning`: Whether the batcher is active and will process items automatically
|
|
81
80
|
* - `items`: Array of items currently queued for batch processing
|
|
82
81
|
* - `size`: Number of items currently in the batch queue
|
|
83
82
|
* - `status`: Current processing status ('idle' | 'pending')
|
|
@@ -137,7 +136,6 @@ interface PreactBatcher<TValue, TSelected = {}> extends Omit<Batcher<TValue>, 's
|
|
|
137
136
|
* { maxSize: 5, wait: 2000 },
|
|
138
137
|
* (state) => ({
|
|
139
138
|
* isPending: state.isPending,
|
|
140
|
-
* isRunning: state.isRunning,
|
|
141
139
|
* status: state.status
|
|
142
140
|
* })
|
|
143
141
|
* );
|
|
@@ -161,14 +159,12 @@ interface PreactBatcher<TValue, TSelected = {}> extends Omit<Batcher<TValue>, 's
|
|
|
161
159
|
* batcher.addItem(3); // Triggers batch processing
|
|
162
160
|
*
|
|
163
161
|
* // Control the batcher
|
|
164
|
-
* batcher.
|
|
165
|
-
* batcher.
|
|
162
|
+
* batcher.cancel(); // Cancel the pending timer; queued items are retained
|
|
163
|
+
* batcher.flush(); // Process queued items immediately
|
|
166
164
|
*
|
|
167
165
|
* // Access the selected state (will be empty object {} unless selector provided)
|
|
168
166
|
* const { size, isPending } = batcher.state;
|
|
169
167
|
* ```
|
|
170
168
|
*/
|
|
171
|
-
declare function useBatcher<TValue, TSelected = {}>(fn: (items: Array<TValue>) => void, options?: PreactBatcherOptions<TValue, TSelected>, selector?: (state: BatcherState<TValue>) => TSelected): PreactBatcher<TValue, TSelected>;
|
|
172
|
-
//#endregion
|
|
173
|
-
export { PreactBatcher, PreactBatcherOptions, useBatcher };
|
|
174
|
-
//# 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.
|
|
129
|
-
* batcher.
|
|
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 };
|
|
@@ -37,7 +37,5 @@ import { AnyFunction } from "@tanstack/pacer/types";
|
|
|
37
37
|
* />
|
|
38
38
|
* ```
|
|
39
39
|
*/
|
|
40
|
-
declare function useDebouncedCallback<TFn extends AnyFunction>(fn: TFn, options: PreactDebouncerOptions<TFn, {}>): (...args: Parameters<TFn>) => void;
|
|
41
|
-
//#endregion
|
|
42
|
-
export { useDebouncedCallback };
|
|
43
|
-
//# sourceMappingURL=useDebouncedCallback.d.ts.map
|
|
40
|
+
export declare function useDebouncedCallback<TFn extends AnyFunction>(fn: TFn, options: PreactDebouncerOptions<TFn, {}>): (...args: Parameters<TFn>) => void;
|
|
41
|
+
//#endregion
|
|
@@ -74,7 +74,5 @@ import { DebouncerState } from "@tanstack/pacer/debouncer";
|
|
|
74
74
|
* const { isPending, executionCount } = debouncer.state;
|
|
75
75
|
* ```
|
|
76
76
|
*/
|
|
77
|
-
declare function useDebouncedState<TValue, TSelected = DebouncerState<Dispatch<StateUpdater<TValue>>>>(value: TValue, options: PreactDebouncerOptions<Dispatch<StateUpdater<TValue>>, TSelected>, selector?: (state: DebouncerState<Dispatch<StateUpdater<TValue>>>) => TSelected): [TValue, Dispatch<StateUpdater<TValue>>, PreactDebouncer<Dispatch<StateUpdater<TValue>>, TSelected>];
|
|
78
|
-
//#endregion
|
|
79
|
-
export { useDebouncedState };
|
|
80
|
-
//# sourceMappingURL=useDebouncedState.d.ts.map
|
|
77
|
+
export declare function useDebouncedState<TValue, TSelected = DebouncerState<Dispatch<StateUpdater<TValue>>>>(value: TValue, options: PreactDebouncerOptions<Dispatch<StateUpdater<TValue>>, TSelected>, selector?: (state: DebouncerState<Dispatch<StateUpdater<TValue>>>) => TSelected): [TValue, Dispatch<StateUpdater<TValue>>, PreactDebouncer<Dispatch<StateUpdater<TValue>>, TSelected>];
|
|
78
|
+
//#endregion
|
|
@@ -83,7 +83,5 @@ import { DebouncerState } from "@tanstack/pacer/debouncer";
|
|
|
83
83
|
* const { isPending, executionCount } = debouncer.state;
|
|
84
84
|
* ```
|
|
85
85
|
*/
|
|
86
|
-
declare function useDebouncedValue<TValue, TSelected = DebouncerState<Dispatch<StateUpdater<TValue>>>>(value: TValue, options: PreactDebouncerOptions<Dispatch<StateUpdater<TValue>>, TSelected>, selector?: (state: DebouncerState<Dispatch<StateUpdater<TValue>>>) => TSelected): [TValue, PreactDebouncer<Dispatch<StateUpdater<TValue>>, TSelected>];
|
|
87
|
-
//#endregion
|
|
88
|
-
export { useDebouncedValue };
|
|
89
|
-
//# sourceMappingURL=useDebouncedValue.d.ts.map
|
|
86
|
+
export declare function useDebouncedValue<TValue, TSelected = DebouncerState<Dispatch<StateUpdater<TValue>>>>(value: TValue, options: PreactDebouncerOptions<Dispatch<StateUpdater<TValue>>, TSelected>, selector?: (state: DebouncerState<Dispatch<StateUpdater<TValue>>>) => TSelected): [TValue, PreactDebouncer<Dispatch<StateUpdater<TValue>>, TSelected>];
|
|
87
|
+
//#endregion
|
|
@@ -3,14 +3,14 @@ import { Store } from "@tanstack/preact-store";
|
|
|
3
3
|
import { Debouncer, DebouncerOptions, DebouncerState } from "@tanstack/pacer/debouncer";
|
|
4
4
|
import { AnyFunction } from "@tanstack/pacer/types";
|
|
5
5
|
//#region src/debouncer/useDebouncer.d.ts
|
|
6
|
-
interface PreactDebouncerOptions<TFn extends AnyFunction, TSelected = {}> extends DebouncerOptions<TFn> {
|
|
6
|
+
export interface PreactDebouncerOptions<TFn extends AnyFunction, TSelected = {}> extends DebouncerOptions<TFn> {
|
|
7
7
|
/**
|
|
8
8
|
* Optional callback invoked when the component unmounts. Receives the debouncer instance.
|
|
9
9
|
* When provided, replaces the default cleanup (cancel); use it to call flush(), reset(), cancel(), add logging, etc.
|
|
10
10
|
*/
|
|
11
11
|
onUnmount?: (debouncer: PreactDebouncer<TFn, TSelected>) => void;
|
|
12
12
|
}
|
|
13
|
-
interface PreactDebouncer<TFn extends AnyFunction, TSelected = {}> extends Omit<Debouncer<TFn>, 'store'> {
|
|
13
|
+
export interface PreactDebouncer<TFn extends AnyFunction, TSelected = {}> extends Omit<Debouncer<TFn>, 'store'> {
|
|
14
14
|
/**
|
|
15
15
|
* A Preact HOC (Higher Order Component) that allows you to subscribe to the debouncer state.
|
|
16
16
|
*
|
|
@@ -145,7 +145,5 @@ interface PreactDebouncer<TFn extends AnyFunction, TSelected = {}> extends Omit<
|
|
|
145
145
|
* const { isPending } = searchDebouncer.state;
|
|
146
146
|
* ```
|
|
147
147
|
*/
|
|
148
|
-
declare function useDebouncer<TFn extends AnyFunction, TSelected = {}>(fn: TFn, options: PreactDebouncerOptions<TFn, TSelected>, selector?: (state: DebouncerState<TFn>) => TSelected): PreactDebouncer<TFn, TSelected>;
|
|
149
|
-
//#endregion
|
|
150
|
-
export { PreactDebouncer, PreactDebouncerOptions, useDebouncer };
|
|
151
|
-
//# sourceMappingURL=useDebouncer.d.ts.map
|
|
148
|
+
export declare function useDebouncer<TFn extends AnyFunction, TSelected = {}>(fn: TFn, options: PreactDebouncerOptions<TFn, TSelected>, selector?: (state: DebouncerState<TFn>) => TSelected): PreactDebouncer<TFn, TSelected>;
|
|
149
|
+
//#endregion
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AnyAsyncFunction, AnyFunction, AsyncBatcherOptions, AsyncDebouncerOptions, AsyncQueuerOptions, AsyncRateLimiterOptions, AsyncThrottlerOptions, BatcherOptions, DebouncerOptions, QueuerOptions, RateLimiterOptions, ThrottlerOptions } from "@tanstack/pacer";
|
|
2
2
|
import { ComponentChildren } from "preact";
|
|
3
3
|
//#region src/provider/PacerProvider.d.ts
|
|
4
|
-
interface PacerProviderOptions {
|
|
4
|
+
export interface PacerProviderOptions {
|
|
5
5
|
asyncBatcher?: Partial<AsyncBatcherOptions<any>>;
|
|
6
6
|
asyncDebouncer?: Partial<AsyncDebouncerOptions<AnyAsyncFunction>>;
|
|
7
7
|
asyncQueuer?: Partial<AsyncQueuerOptions<any>>;
|
|
@@ -16,13 +16,11 @@ interface PacerProviderOptions {
|
|
|
16
16
|
interface PacerContextValue {
|
|
17
17
|
defaultOptions: PacerProviderOptions;
|
|
18
18
|
}
|
|
19
|
-
interface PacerProviderProps {
|
|
19
|
+
export interface PacerProviderProps {
|
|
20
20
|
children: ComponentChildren;
|
|
21
21
|
defaultOptions?: PacerProviderOptions;
|
|
22
22
|
}
|
|
23
|
-
declare function PacerProvider({ children, defaultOptions }: PacerProviderProps): import("preact").JSX.Element;
|
|
24
|
-
declare function usePacerContext(): PacerContextValue | null;
|
|
25
|
-
declare function useDefaultPacerOptions(): PacerProviderOptions;
|
|
26
|
-
//#endregion
|
|
27
|
-
export { PacerProvider, PacerProviderOptions, PacerProviderProps, useDefaultPacerOptions, usePacerContext };
|
|
28
|
-
//# sourceMappingURL=PacerProvider.d.ts.map
|
|
23
|
+
export declare function PacerProvider({ children, defaultOptions }: PacerProviderProps): import("preact").JSX.Element;
|
|
24
|
+
export declare function usePacerContext(): PacerContextValue | null;
|
|
25
|
+
export declare function useDefaultPacerOptions(): PacerProviderOptions;
|
|
26
|
+
//#endregion
|
|
@@ -115,7 +115,5 @@ import { Queuer, QueuerState } from "@tanstack/pacer/queuer";
|
|
|
115
115
|
* const { size, isRunning, executionCount } = queue.state;
|
|
116
116
|
* ```
|
|
117
117
|
*/
|
|
118
|
-
declare function useQueuedState<TValue, TSelected extends Pick<QueuerState<TValue>, 'items'> = Pick<QueuerState<TValue>, 'items'>>(fn: (item: TValue) => void, options?: PreactQueuerOptions<TValue, TSelected>, selector?: (state: QueuerState<TValue>) => TSelected): [Array<TValue>, Queuer<TValue>['addItem'], PreactQueuer<TValue, TSelected>];
|
|
119
|
-
//#endregion
|
|
120
|
-
export { useQueuedState };
|
|
121
|
-
//# sourceMappingURL=useQueuedState.d.ts.map
|
|
118
|
+
export declare function useQueuedState<TValue, TSelected extends Pick<QueuerState<TValue>, 'items'> = Pick<QueuerState<TValue>, 'items'>>(fn: (item: TValue) => void, options?: PreactQueuerOptions<TValue, TSelected>, selector?: (state: QueuerState<TValue>) => TSelected): [Array<TValue>, Queuer<TValue>['addItem'], PreactQueuer<TValue, TSelected>];
|
|
119
|
+
//#endregion
|