@tanstack/solid-pacer 0.22.0 → 0.23.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/README.md +4 -4
- package/dist/async-batcher/createAsyncBatcher.d.ts +5 -9
- package/dist/async-batcher/createAsyncBatcher.js +2 -5
- package/dist/async-debouncer/createAsyncDebouncer.d.ts +8 -11
- package/dist/async-debouncer/createAsyncDebouncer.js +5 -7
- package/dist/async-queuer/createAsyncQueuer.d.ts +9 -11
- package/dist/async-queuer/createAsyncQueuer.js +4 -5
- package/dist/async-rate-limiter/createAsyncRateLimiter.d.ts +10 -12
- package/dist/async-rate-limiter/createAsyncRateLimiter.js +7 -8
- package/dist/async-throttler/createAsyncThrottler.d.ts +8 -13
- package/dist/async-throttler/createAsyncThrottler.js +5 -9
- package/dist/batcher/createBatcher.d.ts +11 -14
- package/dist/batcher/createBatcher.js +6 -8
- package/dist/debouncer/createDebouncedSignal.d.ts +2 -4
- package/dist/debouncer/createDebouncedSignal.js +1 -2
- package/dist/debouncer/createDebouncedValue.d.ts +2 -4
- package/dist/debouncer/createDebouncedValue.js +1 -2
- package/dist/debouncer/createDebouncer.d.ts +4 -6
- package/dist/debouncer/createDebouncer.js +1 -2
- package/dist/provider/PacerProvider.d.ts +6 -8
- package/dist/provider/PacerProvider.js +1 -2
- package/dist/queuer/createQueuedSignal.d.ts +2 -4
- package/dist/queuer/createQueuedSignal.js +1 -2
- package/dist/queuer/createQueuer.d.ts +4 -6
- package/dist/queuer/createQueuer.js +1 -2
- package/dist/rate-limiter/createRateLimitedSignal.d.ts +12 -13
- package/dist/rate-limiter/createRateLimitedSignal.js +11 -11
- package/dist/rate-limiter/createRateLimitedValue.d.ts +2 -4
- package/dist/rate-limiter/createRateLimitedValue.js +1 -2
- package/dist/rate-limiter/createRateLimiter.d.ts +8 -9
- package/dist/rate-limiter/createRateLimiter.js +5 -5
- package/dist/throttler/createThrottledSignal.d.ts +2 -6
- package/dist/throttler/createThrottledSignal.js +1 -4
- package/dist/throttler/createThrottledValue.d.ts +2 -6
- package/dist/throttler/createThrottledValue.js +1 -4
- package/dist/throttler/createThrottler.d.ts +4 -8
- package/dist/throttler/createThrottler.js +1 -4
- package/package.json +23 -67
- package/dist/async-batcher/createAsyncBatcher.cjs +0 -166
- package/dist/async-batcher/createAsyncBatcher.cjs.map +0 -1
- package/dist/async-batcher/createAsyncBatcher.d.cts +0 -177
- package/dist/async-batcher/createAsyncBatcher.js.map +0 -1
- package/dist/async-batcher/index.cjs +0 -11
- package/dist/async-batcher/index.d.cts +0 -3
- package/dist/async-debouncer/createAsyncDebouncer.cjs +0 -151
- package/dist/async-debouncer/createAsyncDebouncer.cjs.map +0 -1
- package/dist/async-debouncer/createAsyncDebouncer.d.cts +0 -163
- package/dist/async-debouncer/createAsyncDebouncer.js.map +0 -1
- package/dist/async-debouncer/index.cjs +0 -11
- package/dist/async-debouncer/index.d.cts +0 -3
- package/dist/async-queuer/createAsyncQueuer.cjs +0 -158
- package/dist/async-queuer/createAsyncQueuer.cjs.map +0 -1
- package/dist/async-queuer/createAsyncQueuer.d.cts +0 -169
- package/dist/async-queuer/createAsyncQueuer.js.map +0 -1
- package/dist/async-queuer/index.cjs +0 -11
- package/dist/async-queuer/index.d.cts +0 -3
- package/dist/async-rate-limiter/createAsyncRateLimiter.cjs +0 -193
- package/dist/async-rate-limiter/createAsyncRateLimiter.cjs.map +0 -1
- package/dist/async-rate-limiter/createAsyncRateLimiter.d.cts +0 -208
- package/dist/async-rate-limiter/createAsyncRateLimiter.js.map +0 -1
- package/dist/async-rate-limiter/index.cjs +0 -11
- package/dist/async-rate-limiter/index.d.cts +0 -3
- package/dist/async-throttler/createAsyncThrottler.cjs +0 -151
- package/dist/async-throttler/createAsyncThrottler.cjs.map +0 -1
- package/dist/async-throttler/createAsyncThrottler.d.cts +0 -163
- package/dist/async-throttler/createAsyncThrottler.js.map +0 -1
- package/dist/async-throttler/index.cjs +0 -11
- package/dist/async-throttler/index.d.cts +0 -3
- package/dist/batcher/createBatcher.cjs +0 -132
- package/dist/batcher/createBatcher.cjs.map +0 -1
- package/dist/batcher/createBatcher.d.cts +0 -146
- package/dist/batcher/createBatcher.js.map +0 -1
- package/dist/batcher/index.cjs +0 -11
- package/dist/batcher/index.d.cts +0 -3
- package/dist/debouncer/createDebouncedSignal.cjs +0 -88
- package/dist/debouncer/createDebouncedSignal.cjs.map +0 -1
- package/dist/debouncer/createDebouncedSignal.d.cts +0 -79
- package/dist/debouncer/createDebouncedSignal.js.map +0 -1
- package/dist/debouncer/createDebouncedValue.cjs +0 -77
- package/dist/debouncer/createDebouncedValue.cjs.map +0 -1
- package/dist/debouncer/createDebouncedValue.d.cts +0 -70
- package/dist/debouncer/createDebouncedValue.js.map +0 -1
- package/dist/debouncer/createDebouncer.cjs +0 -129
- package/dist/debouncer/createDebouncer.cjs.map +0 -1
- package/dist/debouncer/createDebouncer.d.cts +0 -144
- package/dist/debouncer/createDebouncer.js.map +0 -1
- package/dist/debouncer/index.cjs +0 -15
- package/dist/debouncer/index.d.cts +0 -5
- package/dist/index.cjs +0 -47
- package/dist/index.d.cts +0 -20
- package/dist/provider/PacerProvider.cjs +0 -27
- 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/createQueuedSignal.cjs +0 -129
- package/dist/queuer/createQueuedSignal.cjs.map +0 -1
- package/dist/queuer/createQueuedSignal.d.cts +0 -121
- package/dist/queuer/createQueuedSignal.js.map +0 -1
- package/dist/queuer/createQueuer.cjs +0 -133
- package/dist/queuer/createQueuer.cjs.map +0 -1
- package/dist/queuer/createQueuer.d.cts +0 -147
- package/dist/queuer/createQueuer.js.map +0 -1
- package/dist/queuer/index.cjs +0 -13
- package/dist/queuer/index.d.cts +0 -4
- package/dist/rate-limiter/createRateLimitedSignal.cjs +0 -102
- package/dist/rate-limiter/createRateLimitedSignal.cjs.map +0 -1
- package/dist/rate-limiter/createRateLimitedSignal.d.cts +0 -93
- package/dist/rate-limiter/createRateLimitedSignal.js.map +0 -1
- package/dist/rate-limiter/createRateLimitedValue.cjs +0 -102
- package/dist/rate-limiter/createRateLimitedValue.cjs.map +0 -1
- package/dist/rate-limiter/createRateLimitedValue.d.cts +0 -95
- package/dist/rate-limiter/createRateLimitedValue.js.map +0 -1
- package/dist/rate-limiter/createRateLimiter.cjs +0 -157
- package/dist/rate-limiter/createRateLimiter.cjs.map +0 -1
- package/dist/rate-limiter/createRateLimiter.d.cts +0 -173
- package/dist/rate-limiter/createRateLimiter.js.map +0 -1
- package/dist/rate-limiter/index.cjs +0 -15
- package/dist/rate-limiter/index.d.cts +0 -5
- package/dist/throttler/createThrottledSignal.cjs +0 -79
- package/dist/throttler/createThrottledSignal.cjs.map +0 -1
- package/dist/throttler/createThrottledSignal.d.cts +0 -70
- package/dist/throttler/createThrottledSignal.js.map +0 -1
- package/dist/throttler/createThrottledValue.cjs +0 -74
- package/dist/throttler/createThrottledValue.cjs.map +0 -1
- package/dist/throttler/createThrottledValue.d.cts +0 -67
- package/dist/throttler/createThrottledValue.js.map +0 -1
- package/dist/throttler/createThrottler.cjs +0 -132
- package/dist/throttler/createThrottler.cjs.map +0 -1
- package/dist/throttler/createThrottler.d.cts +0 -147
- package/dist/throttler/createThrottler.js.map +0 -1
- package/dist/throttler/index.cjs +0 -15
- package/dist/throttler/index.d.cts +0 -5
- 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/createAsyncBatcher.ts +0 -234
- package/src/async-batcher/index.ts +0 -3
- package/src/async-debouncer/createAsyncDebouncer.ts +0 -225
- package/src/async-debouncer/index.ts +0 -4
- package/src/async-queuer/createAsyncQueuer.ts +0 -226
- package/src/async-queuer/index.ts +0 -3
- package/src/async-rate-limiter/createAsyncRateLimiter.ts +0 -269
- package/src/async-rate-limiter/index.ts +0 -4
- package/src/async-throttler/createAsyncThrottler.ts +0 -225
- package/src/async-throttler/index.ts +0 -4
- package/src/batcher/createBatcher.ts +0 -199
- package/src/batcher/index.ts +0 -3
- package/src/debouncer/createDebouncedSignal.ts +0 -92
- package/src/debouncer/createDebouncedValue.ts +0 -85
- package/src/debouncer/createDebouncer.ts +0 -201
- package/src/debouncer/index.ts +0 -6
- package/src/index.ts +0 -46
- package/src/provider/PacerProvider.tsx +0 -63
- package/src/provider/index.ts +0 -1
- package/src/queuer/createQueuedSignal.ts +0 -138
- package/src/queuer/createQueuer.ts +0 -199
- package/src/queuer/index.ts +0 -4
- package/src/rate-limiter/createRateLimitedSignal.ts +0 -117
- package/src/rate-limiter/createRateLimitedValue.ts +0 -110
- package/src/rate-limiter/createRateLimiter.ts +0 -226
- package/src/rate-limiter/index.ts +0 -5
- package/src/throttler/createThrottledSignal.ts +0 -81
- package/src/throttler/createThrottledValue.ts +0 -82
- package/src/throttler/createThrottler.ts +0 -204
- package/src/throttler/index.ts +0 -6
- package/src/types/index.ts +0 -1
- package/src/utils/index.ts +0 -1
package/README.md
CHANGED
|
@@ -103,10 +103,10 @@ A lightweight timing and scheduling library for debouncing, throttling, rate lim
|
|
|
103
103
|
> [!NOTE]
|
|
104
104
|
> You may know **TanStack Pacer** by our adapter names, too!
|
|
105
105
|
>
|
|
106
|
-
> - [**React Pacer**](https://tanstack.com/pacer/latest/docs/framework/react
|
|
107
|
-
> - [**Preact Pacer**](https://tanstack.com/pacer/latest/docs/framework/preact
|
|
108
|
-
> - [**Solid Pacer**](https://tanstack.com/pacer/latest/docs/framework/solid
|
|
109
|
-
> - [**Angular Pacer**](https://tanstack.com/pacer/latest/docs/framework/angular
|
|
106
|
+
> - [**React Pacer**](https://tanstack.com/pacer/latest/docs/framework/react)
|
|
107
|
+
> - [**Preact Pacer**](https://tanstack.com/pacer/latest/docs/framework/preact)
|
|
108
|
+
> - [**Solid Pacer**](https://tanstack.com/pacer/latest/docs/framework/solid)
|
|
109
|
+
> - [**Angular Pacer**](https://tanstack.com/pacer/latest/docs/framework/angular)
|
|
110
110
|
> - Svelte Pacer - needs a contributor!
|
|
111
111
|
> - Vue Pacer - needs a contributor!
|
|
112
112
|
|
|
@@ -2,14 +2,14 @@ import { Accessor, JSX } from "solid-js";
|
|
|
2
2
|
import { AsyncBatcher, AsyncBatcherOptions, AsyncBatcherState } from "@tanstack/pacer/async-batcher";
|
|
3
3
|
import { Store } from "@tanstack/solid-store";
|
|
4
4
|
//#region src/async-batcher/createAsyncBatcher.d.ts
|
|
5
|
-
interface SolidAsyncBatcherOptions<TValue, TSelected = {}> extends AsyncBatcherOptions<TValue> {
|
|
5
|
+
export interface SolidAsyncBatcherOptions<TValue, TSelected = {}> extends AsyncBatcherOptions<TValue> {
|
|
6
6
|
/**
|
|
7
7
|
* Optional callback invoked when the owning 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: SolidAsyncBatcher<TValue, TSelected>) => void;
|
|
11
11
|
}
|
|
12
|
-
interface SolidAsyncBatcher<TValue, TSelected = {}> extends Omit<AsyncBatcher<TValue>, 'store'> {
|
|
12
|
+
export interface SolidAsyncBatcher<TValue, TSelected = {}> extends Omit<AsyncBatcher<TValue>, 'store'> {
|
|
13
13
|
/**
|
|
14
14
|
* A Solid component that allows you to subscribe to the batcher state.
|
|
15
15
|
*
|
|
@@ -94,10 +94,8 @@ interface SolidAsyncBatcher<TValue, TSelected = {}> extends Omit<AsyncBatcher<TV
|
|
|
94
94
|
* Available state properties:
|
|
95
95
|
* - `errorCount`: Number of failed batch executions
|
|
96
96
|
* - `executionCount`: Total number of batch execution attempts (successful + failed)
|
|
97
|
-
* - `hasError`: Whether the last batch execution resulted in an error
|
|
98
97
|
* - `isExecuting`: Whether a batch execution is currently in progress
|
|
99
98
|
* - `items`: Array of items currently queued for batching
|
|
100
|
-
* - `lastError`: The error from the most recent failed batch execution (if any)
|
|
101
99
|
* - `lastResult`: The result from the most recent successful batch execution
|
|
102
100
|
* - `settleCount`: Number of batch executions that have completed (successful or failed)
|
|
103
101
|
* - `successCount`: Number of successful batch executions
|
|
@@ -158,7 +156,7 @@ interface SolidAsyncBatcher<TValue, TSelected = {}> extends Omit<AsyncBatcher<TV
|
|
|
158
156
|
* return results;
|
|
159
157
|
* },
|
|
160
158
|
* { maxSize: 10, wait: 2000 },
|
|
161
|
-
* (state) => ({
|
|
159
|
+
* (state) => ({ errorCount: state.errorCount })
|
|
162
160
|
* );
|
|
163
161
|
*
|
|
164
162
|
* // Add items to batch
|
|
@@ -171,7 +169,5 @@ interface SolidAsyncBatcher<TValue, TSelected = {}> extends Omit<AsyncBatcher<TV
|
|
|
171
169
|
* const { items, isExecuting } = asyncBatcher.state();
|
|
172
170
|
* ```
|
|
173
171
|
*/
|
|
174
|
-
declare function createAsyncBatcher<TValue, TSelected = {}>(fn: (items: Array<TValue>) => Promise<any>, options?: SolidAsyncBatcherOptions<TValue, TSelected>, selector?: (state: AsyncBatcherState<TValue>) => TSelected): SolidAsyncBatcher<TValue, TSelected>;
|
|
175
|
-
//#endregion
|
|
176
|
-
export { SolidAsyncBatcher, SolidAsyncBatcherOptions, createAsyncBatcher };
|
|
177
|
-
//# sourceMappingURL=createAsyncBatcher.d.ts.map
|
|
172
|
+
export declare function createAsyncBatcher<TValue, TSelected = {}>(fn: (items: Array<TValue>) => Promise<any>, options?: SolidAsyncBatcherOptions<TValue, TSelected>, selector?: (state: AsyncBatcherState<TValue>) => TSelected): SolidAsyncBatcher<TValue, TSelected>;
|
|
173
|
+
//#endregion
|
|
@@ -58,10 +58,8 @@ import { shallow, useSelector } from "@tanstack/solid-store";
|
|
|
58
58
|
* Available state properties:
|
|
59
59
|
* - `errorCount`: Number of failed batch executions
|
|
60
60
|
* - `executionCount`: Total number of batch execution attempts (successful + failed)
|
|
61
|
-
* - `hasError`: Whether the last batch execution resulted in an error
|
|
62
61
|
* - `isExecuting`: Whether a batch execution is currently in progress
|
|
63
62
|
* - `items`: Array of items currently queued for batching
|
|
64
|
-
* - `lastError`: The error from the most recent failed batch execution (if any)
|
|
65
63
|
* - `lastResult`: The result from the most recent successful batch execution
|
|
66
64
|
* - `settleCount`: Number of batch executions that have completed (successful or failed)
|
|
67
65
|
* - `successCount`: Number of successful batch executions
|
|
@@ -122,7 +120,7 @@ import { shallow, useSelector } from "@tanstack/solid-store";
|
|
|
122
120
|
* return results;
|
|
123
121
|
* },
|
|
124
122
|
* { maxSize: 10, wait: 2000 },
|
|
125
|
-
* (state) => ({
|
|
123
|
+
* (state) => ({ errorCount: state.errorCount })
|
|
126
124
|
* );
|
|
127
125
|
*
|
|
128
126
|
* // Add items to batch
|
|
@@ -162,5 +160,4 @@ function createAsyncBatcher(fn, options = {}, selector = () => ({})) {
|
|
|
162
160
|
}
|
|
163
161
|
|
|
164
162
|
//#endregion
|
|
165
|
-
export { createAsyncBatcher };
|
|
166
|
-
//# sourceMappingURL=createAsyncBatcher.js.map
|
|
163
|
+
export { createAsyncBatcher };
|
|
@@ -3,14 +3,14 @@ import { Store } from "@tanstack/solid-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/createAsyncDebouncer.d.ts
|
|
6
|
-
interface SolidAsyncDebouncerOptions<TFn extends AnyAsyncFunction, TSelected = {}> extends AsyncDebouncerOptions<TFn> {
|
|
6
|
+
export interface SolidAsyncDebouncerOptions<TFn extends AnyAsyncFunction, TSelected = {}> extends AsyncDebouncerOptions<TFn> {
|
|
7
7
|
/**
|
|
8
8
|
* Optional callback invoked when the owning 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: SolidAsyncDebouncer<TFn, TSelected>) => void;
|
|
12
12
|
}
|
|
13
|
-
interface SolidAsyncDebouncer<TFn extends AnyAsyncFunction, TSelected = {}> extends Omit<AsyncDebouncer<TFn>, 'store'> {
|
|
13
|
+
export interface SolidAsyncDebouncer<TFn extends AnyAsyncFunction, TSelected = {}> extends Omit<AsyncDebouncer<TFn>, 'store'> {
|
|
14
14
|
/**
|
|
15
15
|
* A Solid component that allows you to subscribe to the debouncer state.
|
|
16
16
|
*
|
|
@@ -88,14 +88,13 @@ interface SolidAsyncDebouncer<TFn extends AnyAsyncFunction, TSelected = {}> exte
|
|
|
88
88
|
*
|
|
89
89
|
* Available state properties:
|
|
90
90
|
* - `canLeadingExecute`: Whether the debouncer can execute on the leading edge
|
|
91
|
-
* - `
|
|
92
|
-
* - `
|
|
91
|
+
* - `settleCount`: Number of function executions that have completed (success or error)
|
|
92
|
+
* - `errorCount`: Number of function executions that have resulted in errors
|
|
93
93
|
* - `isPending`: Whether the debouncer is waiting for the timeout to trigger execution
|
|
94
94
|
* - `isExecuting`: Whether an async function execution is currently in progress
|
|
95
95
|
* - `lastArgs`: The arguments from the most recent call to maybeExecute
|
|
96
|
-
* - `lastError`: The error from the most recent failed execution (if any)
|
|
97
96
|
* - `lastResult`: The result from the most recent successful execution
|
|
98
|
-
* - `status`: Current execution status ('disabled' | 'idle' | 'pending' | 'executing')
|
|
97
|
+
* - `status`: Current execution status ('disabled' | 'idle' | 'pending' | 'executing' | 'settled')
|
|
99
98
|
*
|
|
100
99
|
* ## Unmount behavior
|
|
101
100
|
*
|
|
@@ -150,14 +149,12 @@ interface SolidAsyncDebouncer<TFn extends AnyAsyncFunction, TSelected = {}> exte
|
|
|
150
149
|
* console.error('API call failed:', error);
|
|
151
150
|
* }
|
|
152
151
|
* },
|
|
153
|
-
* (state) => ({
|
|
152
|
+
* (state) => ({ errorCount: state.errorCount })
|
|
154
153
|
* );
|
|
155
154
|
*
|
|
156
155
|
* // Access the selected state (will be empty object {} unless selector provided)
|
|
157
156
|
* const { isPending, isExecuting } = debouncer.state();
|
|
158
157
|
* ```
|
|
159
158
|
*/
|
|
160
|
-
declare function createAsyncDebouncer<TFn extends AnyAsyncFunction, TSelected = {}>(fn: TFn, options: SolidAsyncDebouncerOptions<TFn, TSelected>, selector?: (state: AsyncDebouncerState<TFn>) => TSelected): SolidAsyncDebouncer<TFn, TSelected>;
|
|
161
|
-
//#endregion
|
|
162
|
-
export { SolidAsyncDebouncer, SolidAsyncDebouncerOptions, createAsyncDebouncer };
|
|
163
|
-
//# sourceMappingURL=createAsyncDebouncer.d.ts.map
|
|
159
|
+
export declare function createAsyncDebouncer<TFn extends AnyAsyncFunction, TSelected = {}>(fn: TFn, options: SolidAsyncDebouncerOptions<TFn, TSelected>, selector?: (state: AsyncDebouncerState<TFn>) => TSelected): SolidAsyncDebouncer<TFn, TSelected>;
|
|
160
|
+
//#endregion
|
|
@@ -51,14 +51,13 @@ import { AsyncDebouncer } from "@tanstack/pacer/async-debouncer";
|
|
|
51
51
|
*
|
|
52
52
|
* Available state properties:
|
|
53
53
|
* - `canLeadingExecute`: Whether the debouncer can execute on the leading edge
|
|
54
|
-
* - `
|
|
55
|
-
* - `
|
|
54
|
+
* - `settleCount`: Number of function executions that have completed (success or error)
|
|
55
|
+
* - `errorCount`: Number of function executions that have resulted in errors
|
|
56
56
|
* - `isPending`: Whether the debouncer is waiting for the timeout to trigger execution
|
|
57
57
|
* - `isExecuting`: Whether an async function execution is currently in progress
|
|
58
58
|
* - `lastArgs`: The arguments from the most recent call to maybeExecute
|
|
59
|
-
* - `lastError`: The error from the most recent failed execution (if any)
|
|
60
59
|
* - `lastResult`: The result from the most recent successful execution
|
|
61
|
-
* - `status`: Current execution status ('disabled' | 'idle' | 'pending' | 'executing')
|
|
60
|
+
* - `status`: Current execution status ('disabled' | 'idle' | 'pending' | 'executing' | 'settled')
|
|
62
61
|
*
|
|
63
62
|
* ## Unmount behavior
|
|
64
63
|
*
|
|
@@ -113,7 +112,7 @@ import { AsyncDebouncer } from "@tanstack/pacer/async-debouncer";
|
|
|
113
112
|
* console.error('API call failed:', error);
|
|
114
113
|
* }
|
|
115
114
|
* },
|
|
116
|
-
* (state) => ({
|
|
115
|
+
* (state) => ({ errorCount: state.errorCount })
|
|
117
116
|
* );
|
|
118
117
|
*
|
|
119
118
|
* // Access the selected state (will be empty object {} unless selector provided)
|
|
@@ -147,5 +146,4 @@ function createAsyncDebouncer(fn, options, selector = () => ({})) {
|
|
|
147
146
|
}
|
|
148
147
|
|
|
149
148
|
//#endregion
|
|
150
|
-
export { createAsyncDebouncer };
|
|
151
|
-
//# sourceMappingURL=createAsyncDebouncer.js.map
|
|
149
|
+
export { createAsyncDebouncer };
|
|
@@ -2,14 +2,14 @@ import { Accessor, JSX } from "solid-js";
|
|
|
2
2
|
import { Store } from "@tanstack/solid-store";
|
|
3
3
|
import { AsyncQueuer, AsyncQueuerOptions, AsyncQueuerState } from "@tanstack/pacer/async-queuer";
|
|
4
4
|
//#region src/async-queuer/createAsyncQueuer.d.ts
|
|
5
|
-
interface SolidAsyncQueuerOptions<TValue, TSelected = {}> extends AsyncQueuerOptions<TValue> {
|
|
5
|
+
export interface SolidAsyncQueuerOptions<TValue, TSelected = {}> extends AsyncQueuerOptions<TValue> {
|
|
6
6
|
/**
|
|
7
7
|
* Optional callback invoked when the owning 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: SolidAsyncQueuer<TValue, TSelected>) => void;
|
|
11
11
|
}
|
|
12
|
-
interface SolidAsyncQueuer<TValue, TSelected = {}> extends Omit<AsyncQueuer<TValue>, 'store'> {
|
|
12
|
+
export interface SolidAsyncQueuer<TValue, TSelected = {}> extends Omit<AsyncQueuer<TValue>, 'store'> {
|
|
13
13
|
/**
|
|
14
14
|
* A Solid component that allows you to subscribe to the queuer state.
|
|
15
15
|
*
|
|
@@ -17,9 +17,9 @@ interface SolidAsyncQueuer<TValue, TSelected = {}> extends Omit<AsyncQueuer<TVal
|
|
|
17
17
|
* deep in your component tree without needing to pass a selector to the hook.
|
|
18
18
|
*
|
|
19
19
|
* @example
|
|
20
|
-
* <queuer.Subscribe selector={(state) => ({
|
|
20
|
+
* <queuer.Subscribe selector={(state) => ({ items: state.items, activeItems: state.activeItems })}>
|
|
21
21
|
* {(state) => (
|
|
22
|
-
* <div>Pending: {state().
|
|
22
|
+
* <div>Pending: {state().items.length}, Active: {state().activeItems.length}</div>
|
|
23
23
|
* )}
|
|
24
24
|
* </queuer.Subscribe>
|
|
25
25
|
*/
|
|
@@ -88,7 +88,7 @@ interface SolidAsyncQueuer<TValue, TSelected = {}> extends Omit<AsyncQueuer<TVal
|
|
|
88
88
|
* - `activeItems`: Array of items currently being processed
|
|
89
89
|
* - `errorCount`: Number of items that failed processing
|
|
90
90
|
* - `isRunning`: Whether the queuer is currently running (not stopped)
|
|
91
|
-
* - `
|
|
91
|
+
* - `items`: Array of items waiting to be processed
|
|
92
92
|
* - `rejectionCount`: Number of items that were rejected (expired or failed validation)
|
|
93
93
|
* - `settleCount`: Number of items that have completed processing (successful or failed)
|
|
94
94
|
* - `successCount`: Number of items that were processed successfully
|
|
@@ -136,7 +136,7 @@ interface SolidAsyncQueuer<TValue, TSelected = {}> extends Omit<AsyncQueuer<TVal
|
|
|
136
136
|
* async (item) => await fetchData(item),
|
|
137
137
|
* { concurrency: 2, started: true },
|
|
138
138
|
* (state) => ({
|
|
139
|
-
*
|
|
139
|
+
* items: state.items,
|
|
140
140
|
* activeItems: state.activeItems,
|
|
141
141
|
* isRunning: state.isRunning
|
|
142
142
|
* })
|
|
@@ -160,10 +160,8 @@ interface SolidAsyncQueuer<TValue, TSelected = {}> extends Omit<AsyncQueuer<TVal
|
|
|
160
160
|
* asyncQueuer.start();
|
|
161
161
|
*
|
|
162
162
|
* // Access the selected state (will be empty object {} unless selector provided)
|
|
163
|
-
* const {
|
|
163
|
+
* const { items, activeItems } = asyncQueuer.state();
|
|
164
164
|
* ```
|
|
165
165
|
*/
|
|
166
|
-
declare function createAsyncQueuer<TValue, TSelected = {}>(fn: (value: TValue) => Promise<any>, options?: SolidAsyncQueuerOptions<TValue, TSelected>, selector?: (state: AsyncQueuerState<TValue>) => TSelected): SolidAsyncQueuer<TValue, TSelected>;
|
|
167
|
-
//#endregion
|
|
168
|
-
export { SolidAsyncQueuer, SolidAsyncQueuerOptions, createAsyncQueuer };
|
|
169
|
-
//# sourceMappingURL=createAsyncQueuer.d.ts.map
|
|
166
|
+
export declare function createAsyncQueuer<TValue, TSelected = {}>(fn: (value: TValue) => Promise<any>, options?: SolidAsyncQueuerOptions<TValue, TSelected>, selector?: (state: AsyncQueuerState<TValue>) => TSelected): SolidAsyncQueuer<TValue, TSelected>;
|
|
167
|
+
//#endregion
|
|
@@ -52,7 +52,7 @@ import { AsyncQueuer } from "@tanstack/pacer/async-queuer";
|
|
|
52
52
|
* - `activeItems`: Array of items currently being processed
|
|
53
53
|
* - `errorCount`: Number of items that failed processing
|
|
54
54
|
* - `isRunning`: Whether the queuer is currently running (not stopped)
|
|
55
|
-
* - `
|
|
55
|
+
* - `items`: Array of items waiting to be processed
|
|
56
56
|
* - `rejectionCount`: Number of items that were rejected (expired or failed validation)
|
|
57
57
|
* - `settleCount`: Number of items that have completed processing (successful or failed)
|
|
58
58
|
* - `successCount`: Number of items that were processed successfully
|
|
@@ -100,7 +100,7 @@ import { AsyncQueuer } from "@tanstack/pacer/async-queuer";
|
|
|
100
100
|
* async (item) => await fetchData(item),
|
|
101
101
|
* { concurrency: 2, started: true },
|
|
102
102
|
* (state) => ({
|
|
103
|
-
*
|
|
103
|
+
* items: state.items,
|
|
104
104
|
* activeItems: state.activeItems,
|
|
105
105
|
* isRunning: state.isRunning
|
|
106
106
|
* })
|
|
@@ -124,7 +124,7 @@ import { AsyncQueuer } from "@tanstack/pacer/async-queuer";
|
|
|
124
124
|
* asyncQueuer.start();
|
|
125
125
|
*
|
|
126
126
|
* // Access the selected state (will be empty object {} unless selector provided)
|
|
127
|
-
* const {
|
|
127
|
+
* const { items, activeItems } = asyncQueuer.state();
|
|
128
128
|
* ```
|
|
129
129
|
*/
|
|
130
130
|
function createAsyncQueuer(fn, options = {}, selector = () => ({})) {
|
|
@@ -154,5 +154,4 @@ function createAsyncQueuer(fn, options = {}, selector = () => ({})) {
|
|
|
154
154
|
}
|
|
155
155
|
|
|
156
156
|
//#endregion
|
|
157
|
-
export { createAsyncQueuer };
|
|
158
|
-
//# sourceMappingURL=createAsyncQueuer.js.map
|
|
157
|
+
export { createAsyncQueuer };
|
|
@@ -3,14 +3,14 @@ import { Store } from "@tanstack/solid-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/createAsyncRateLimiter.d.ts
|
|
6
|
-
interface SolidAsyncRateLimiterOptions<TFn extends AnyAsyncFunction, TSelected = {}> extends AsyncRateLimiterOptions<TFn> {
|
|
6
|
+
export interface SolidAsyncRateLimiterOptions<TFn extends AnyAsyncFunction, TSelected = {}> extends AsyncRateLimiterOptions<TFn> {
|
|
7
7
|
/**
|
|
8
8
|
* Optional callback invoked when the owning 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: SolidAsyncRateLimiter<TFn, TSelected>) => void;
|
|
12
12
|
}
|
|
13
|
-
interface SolidAsyncRateLimiter<TFn extends AnyAsyncFunction, TSelected = {}> extends Omit<AsyncRateLimiter<TFn>, 'store'> {
|
|
13
|
+
export interface SolidAsyncRateLimiter<TFn extends AnyAsyncFunction, TSelected = {}> extends Omit<AsyncRateLimiter<TFn>, 'store'> {
|
|
14
14
|
/**
|
|
15
15
|
* A Solid component that allows you to subscribe to the rate limiter state.
|
|
16
16
|
*
|
|
@@ -97,16 +97,16 @@ interface SolidAsyncRateLimiter<TFn extends AnyAsyncFunction, TSelected = {}> ex
|
|
|
97
97
|
* tracking by providing a selector function or using the `Subscribe` component. This prevents unnecessary
|
|
98
98
|
* updates and gives you full control over when your component tracks state changes.
|
|
99
99
|
*
|
|
100
|
+
* Use `getRemainingInWindow()` and `getMsUntilNextWindow()` for current window capacity and timing.
|
|
101
|
+
*
|
|
100
102
|
* Available state properties:
|
|
101
|
-
* - `
|
|
102
|
-
* - `
|
|
103
|
-
* - `
|
|
103
|
+
* - `executionTimes`: Timestamps of executions tracked for the current window
|
|
104
|
+
* - `isExceeded`: Whether the rate limit has been reached
|
|
105
|
+
* - `settleCount`: Number of function executions that have completed (success or error)
|
|
106
|
+
* - `errorCount`: Number of function executions that have resulted in errors
|
|
104
107
|
* - `isExecuting`: Whether an async function execution is currently in progress
|
|
105
|
-
* - `lastError`: The error from the most recent failed execution (if any)
|
|
106
108
|
* - `lastResult`: The result from the most recent successful execution
|
|
107
|
-
* - `nextWindowTime`: Timestamp when the next window begins
|
|
108
109
|
* - `rejectionCount`: Number of function calls that were rejected due to rate limiting
|
|
109
|
-
* - `remainingInWindow`: Number of executions remaining in the current window
|
|
110
110
|
*
|
|
111
111
|
* ## Unmount behavior
|
|
112
112
|
*
|
|
@@ -202,7 +202,5 @@ interface SolidAsyncRateLimiter<TFn extends AnyAsyncFunction, TSelected = {}> ex
|
|
|
202
202
|
* const { isExecuting, lastResult, rejectionCount } = asyncRateLimiter.state();
|
|
203
203
|
* ```
|
|
204
204
|
*/
|
|
205
|
-
declare function createAsyncRateLimiter<TFn extends AnyAsyncFunction, TSelected = {}>(fn: TFn, options: SolidAsyncRateLimiterOptions<TFn, TSelected>, selector?: (state: AsyncRateLimiterState<TFn>) => TSelected): SolidAsyncRateLimiter<TFn, TSelected>;
|
|
206
|
-
//#endregion
|
|
207
|
-
export { SolidAsyncRateLimiter, SolidAsyncRateLimiterOptions, createAsyncRateLimiter };
|
|
208
|
-
//# sourceMappingURL=createAsyncRateLimiter.d.ts.map
|
|
205
|
+
export declare function createAsyncRateLimiter<TFn extends AnyAsyncFunction, TSelected = {}>(fn: TFn, options: SolidAsyncRateLimiterOptions<TFn, TSelected>, selector?: (state: AsyncRateLimiterState<TFn>) => TSelected): SolidAsyncRateLimiter<TFn, TSelected>;
|
|
206
|
+
//#endregion
|
|
@@ -60,16 +60,16 @@ import { AsyncRateLimiter } from "@tanstack/pacer/async-rate-limiter";
|
|
|
60
60
|
* tracking by providing a selector function or using the `Subscribe` component. This prevents unnecessary
|
|
61
61
|
* updates and gives you full control over when your component tracks state changes.
|
|
62
62
|
*
|
|
63
|
+
* Use `getRemainingInWindow()` and `getMsUntilNextWindow()` for current window capacity and timing.
|
|
64
|
+
*
|
|
63
65
|
* Available state properties:
|
|
64
|
-
* - `
|
|
65
|
-
* - `
|
|
66
|
-
* - `
|
|
66
|
+
* - `executionTimes`: Timestamps of executions tracked for the current window
|
|
67
|
+
* - `isExceeded`: Whether the rate limit has been reached
|
|
68
|
+
* - `settleCount`: Number of function executions that have completed (success or error)
|
|
69
|
+
* - `errorCount`: Number of function executions that have resulted in errors
|
|
67
70
|
* - `isExecuting`: Whether an async function execution is currently in progress
|
|
68
|
-
* - `lastError`: The error from the most recent failed execution (if any)
|
|
69
71
|
* - `lastResult`: The result from the most recent successful execution
|
|
70
|
-
* - `nextWindowTime`: Timestamp when the next window begins
|
|
71
72
|
* - `rejectionCount`: Number of function calls that were rejected due to rate limiting
|
|
72
|
-
* - `remainingInWindow`: Number of executions remaining in the current window
|
|
73
73
|
*
|
|
74
74
|
* ## Unmount behavior
|
|
75
75
|
*
|
|
@@ -189,5 +189,4 @@ function createAsyncRateLimiter(fn, options, selector = () => ({})) {
|
|
|
189
189
|
}
|
|
190
190
|
|
|
191
191
|
//#endregion
|
|
192
|
-
export { createAsyncRateLimiter };
|
|
193
|
-
//# sourceMappingURL=createAsyncRateLimiter.js.map
|
|
192
|
+
export { createAsyncRateLimiter };
|
|
@@ -3,14 +3,14 @@ import { Store } from "@tanstack/solid-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/createAsyncThrottler.d.ts
|
|
6
|
-
interface SolidAsyncThrottlerOptions<TFn extends AnyAsyncFunction, TSelected = {}> extends AsyncThrottlerOptions<TFn> {
|
|
6
|
+
export interface SolidAsyncThrottlerOptions<TFn extends AnyAsyncFunction, TSelected = {}> extends AsyncThrottlerOptions<TFn> {
|
|
7
7
|
/**
|
|
8
8
|
* Optional callback invoked when the owning 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: SolidAsyncThrottler<TFn, TSelected>) => void;
|
|
12
12
|
}
|
|
13
|
-
interface SolidAsyncThrottler<TFn extends AnyAsyncFunction, TSelected = {}> extends Omit<AsyncThrottler<TFn>, 'store'> {
|
|
13
|
+
export interface SolidAsyncThrottler<TFn extends AnyAsyncFunction, TSelected = {}> extends Omit<AsyncThrottler<TFn>, 'store'> {
|
|
14
14
|
/**
|
|
15
15
|
* A Solid component that allows you to subscribe to the throttler state.
|
|
16
16
|
*
|
|
@@ -84,18 +84,15 @@ interface SolidAsyncThrottler<TFn extends AnyAsyncFunction, TSelected = {}> exte
|
|
|
84
84
|
* updates and gives you full control over when your component tracks state changes.
|
|
85
85
|
*
|
|
86
86
|
* Available state properties:
|
|
87
|
-
* - `
|
|
88
|
-
* - `
|
|
89
|
-
* - `executionCount`: Number of function executions that have been completed
|
|
90
|
-
* - `hasError`: Whether the last execution resulted in an error
|
|
87
|
+
* - `settleCount`: Number of function executions that have completed (success or error)
|
|
88
|
+
* - `errorCount`: Number of function executions that have resulted in errors
|
|
91
89
|
* - `isPending`: Whether the throttler is waiting for the timeout to trigger execution
|
|
92
90
|
* - `isExecuting`: Whether an async function execution is currently in progress
|
|
93
91
|
* - `lastArgs`: The arguments from the most recent call to maybeExecute
|
|
94
|
-
* - `lastError`: The error from the most recent failed execution (if any)
|
|
95
92
|
* - `lastExecutionTime`: Timestamp of the last execution
|
|
96
93
|
* - `lastResult`: The result from the most recent successful execution
|
|
97
94
|
* - `nextExecutionTime`: Timestamp of the next allowed execution
|
|
98
|
-
* - `status`: Current execution status ('disabled' | 'idle' | 'pending' | 'executing')
|
|
95
|
+
* - `status`: Current execution status ('disabled' | 'idle' | 'pending' | 'executing' | 'settled')
|
|
99
96
|
*
|
|
100
97
|
* ## Unmount behavior
|
|
101
98
|
*
|
|
@@ -150,14 +147,12 @@ interface SolidAsyncThrottler<TFn extends AnyAsyncFunction, TSelected = {}> exte
|
|
|
150
147
|
* console.error('API call failed:', error);
|
|
151
148
|
* }
|
|
152
149
|
* },
|
|
153
|
-
* (state) => ({
|
|
150
|
+
* (state) => ({ errorCount: state.errorCount })
|
|
154
151
|
* );
|
|
155
152
|
*
|
|
156
153
|
* // Access the selected state (will be empty object {} unless selector provided)
|
|
157
154
|
* const { isPending, isExecuting } = throttler.state();
|
|
158
155
|
* ```
|
|
159
156
|
*/
|
|
160
|
-
declare function createAsyncThrottler<TFn extends AnyAsyncFunction, TSelected = {}>(fn: TFn, options: SolidAsyncThrottlerOptions<TFn, TSelected>, selector?: (state: AsyncThrottlerState<TFn>) => TSelected): SolidAsyncThrottler<TFn, TSelected>;
|
|
161
|
-
//#endregion
|
|
162
|
-
export { SolidAsyncThrottler, SolidAsyncThrottlerOptions, createAsyncThrottler };
|
|
163
|
-
//# sourceMappingURL=createAsyncThrottler.d.ts.map
|
|
157
|
+
export declare function createAsyncThrottler<TFn extends AnyAsyncFunction, TSelected = {}>(fn: TFn, options: SolidAsyncThrottlerOptions<TFn, TSelected>, selector?: (state: AsyncThrottlerState<TFn>) => TSelected): SolidAsyncThrottler<TFn, TSelected>;
|
|
158
|
+
//#endregion
|
|
@@ -47,18 +47,15 @@ import { AsyncThrottler } from "@tanstack/pacer/async-throttler";
|
|
|
47
47
|
* updates and gives you full control over when your component tracks state changes.
|
|
48
48
|
*
|
|
49
49
|
* Available state properties:
|
|
50
|
-
* - `
|
|
51
|
-
* - `
|
|
52
|
-
* - `executionCount`: Number of function executions that have been completed
|
|
53
|
-
* - `hasError`: Whether the last execution resulted in an error
|
|
50
|
+
* - `settleCount`: Number of function executions that have completed (success or error)
|
|
51
|
+
* - `errorCount`: Number of function executions that have resulted in errors
|
|
54
52
|
* - `isPending`: Whether the throttler is waiting for the timeout to trigger execution
|
|
55
53
|
* - `isExecuting`: Whether an async function execution is currently in progress
|
|
56
54
|
* - `lastArgs`: The arguments from the most recent call to maybeExecute
|
|
57
|
-
* - `lastError`: The error from the most recent failed execution (if any)
|
|
58
55
|
* - `lastExecutionTime`: Timestamp of the last execution
|
|
59
56
|
* - `lastResult`: The result from the most recent successful execution
|
|
60
57
|
* - `nextExecutionTime`: Timestamp of the next allowed execution
|
|
61
|
-
* - `status`: Current execution status ('disabled' | 'idle' | 'pending' | 'executing')
|
|
58
|
+
* - `status`: Current execution status ('disabled' | 'idle' | 'pending' | 'executing' | 'settled')
|
|
62
59
|
*
|
|
63
60
|
* ## Unmount behavior
|
|
64
61
|
*
|
|
@@ -113,7 +110,7 @@ import { AsyncThrottler } from "@tanstack/pacer/async-throttler";
|
|
|
113
110
|
* console.error('API call failed:', error);
|
|
114
111
|
* }
|
|
115
112
|
* },
|
|
116
|
-
* (state) => ({
|
|
113
|
+
* (state) => ({ errorCount: state.errorCount })
|
|
117
114
|
* );
|
|
118
115
|
*
|
|
119
116
|
* // Access the selected state (will be empty object {} unless selector provided)
|
|
@@ -147,5 +144,4 @@ function createAsyncThrottler(fn, options, selector = () => ({})) {
|
|
|
147
144
|
}
|
|
148
145
|
|
|
149
146
|
//#endregion
|
|
150
|
-
export { createAsyncThrottler };
|
|
151
|
-
//# sourceMappingURL=createAsyncThrottler.js.map
|
|
147
|
+
export { createAsyncThrottler };
|
|
@@ -2,14 +2,14 @@ import { Accessor, JSX } from "solid-js";
|
|
|
2
2
|
import { Store } from "@tanstack/solid-store";
|
|
3
3
|
import { Batcher, BatcherOptions, BatcherState } from "@tanstack/pacer/batcher";
|
|
4
4
|
//#region src/batcher/createBatcher.d.ts
|
|
5
|
-
interface SolidBatcherOptions<TValue, TSelected = {}> extends BatcherOptions<TValue> {
|
|
5
|
+
export interface SolidBatcherOptions<TValue, TSelected = {}> extends BatcherOptions<TValue> {
|
|
6
6
|
/**
|
|
7
7
|
* Optional callback invoked when the owning 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: SolidBatcher<TValue, TSelected>) => void;
|
|
11
11
|
}
|
|
12
|
-
interface SolidBatcher<TValue, TSelected = {}> extends Omit<Batcher<TValue>, 'store'> {
|
|
12
|
+
export interface SolidBatcher<TValue, TSelected = {}> extends Omit<Batcher<TValue>, 'store'> {
|
|
13
13
|
/**
|
|
14
14
|
* A Solid component that allows you to subscribe to the batcher state.
|
|
15
15
|
*
|
|
@@ -17,9 +17,9 @@ interface SolidBatcher<TValue, TSelected = {}> extends Omit<Batcher<TValue>, 'st
|
|
|
17
17
|
* deep in your component tree without needing to pass a selector to the hook.
|
|
18
18
|
*
|
|
19
19
|
* @example
|
|
20
|
-
* <batcher.Subscribe selector={(state) => ({ size: state.size,
|
|
20
|
+
* <batcher.Subscribe selector={(state) => ({ size: state.size, isPending: state.isPending })}>
|
|
21
21
|
* {(state) => (
|
|
22
|
-
* <div>Batch: {state().size} items, {state().
|
|
22
|
+
* <div>Batch: {state().size} items, {state().isPending ? 'Pending' : 'Idle'}</div>
|
|
23
23
|
* )}
|
|
24
24
|
* </batcher.Subscribe>
|
|
25
25
|
*/
|
|
@@ -78,7 +78,6 @@ interface SolidBatcher<TValue, TSelected = {}> extends Omit<Batcher<TValue>, 'st
|
|
|
78
78
|
*
|
|
79
79
|
* Available state properties:
|
|
80
80
|
* - `executionCount`: Number of batch executions that have been completed
|
|
81
|
-
* - `isRunning`: Whether the batcher is currently running (not stopped)
|
|
82
81
|
* - `items`: Array of items currently queued for batching
|
|
83
82
|
* - `totalItemsProcessed`: Total number of individual items that have been processed across all batches
|
|
84
83
|
*
|
|
@@ -111,11 +110,11 @@ interface SolidBatcher<TValue, TSelected = {}> extends Omit<Batcher<TValue>, 'st
|
|
|
111
110
|
* }
|
|
112
111
|
* );
|
|
113
112
|
*
|
|
114
|
-
* // Opt-in to track items or
|
|
113
|
+
* // Opt-in to track items or isPending changes (optimized for UI updates)
|
|
115
114
|
* const batcher = createBatcher(
|
|
116
115
|
* (items) => console.log('Processing batch:', items),
|
|
117
116
|
* { maxSize: 5, wait: 2000 },
|
|
118
|
-
* (state) => ({ items: state.items,
|
|
117
|
+
* (state) => ({ items: state.items, isPending: state.isPending })
|
|
119
118
|
* );
|
|
120
119
|
*
|
|
121
120
|
* // Opt-in to track execution metrics changes (optimized for tracking progress)
|
|
@@ -133,14 +132,12 @@ interface SolidBatcher<TValue, TSelected = {}> extends Omit<Batcher<TValue>, 'st
|
|
|
133
132
|
* batcher.addItem('task2');
|
|
134
133
|
*
|
|
135
134
|
* // Control the batcher
|
|
136
|
-
* batcher.
|
|
137
|
-
* batcher.
|
|
135
|
+
* batcher.cancel(); // Cancel the pending timer; queued items are retained
|
|
136
|
+
* batcher.flush(); // Process queued items immediately
|
|
138
137
|
*
|
|
139
138
|
* // Access the selected state (will be empty object {} unless selector provided)
|
|
140
|
-
* const { items,
|
|
139
|
+
* const { items, isPending } = batcher.state();
|
|
141
140
|
* ```
|
|
142
141
|
*/
|
|
143
|
-
declare function createBatcher<TValue, TSelected = {}>(fn: (items: Array<TValue>) => void, options?: SolidBatcherOptions<TValue, TSelected>, selector?: (state: BatcherState<TValue>) => TSelected): SolidBatcher<TValue, TSelected>;
|
|
144
|
-
//#endregion
|
|
145
|
-
export { SolidBatcher, SolidBatcherOptions, createBatcher };
|
|
146
|
-
//# sourceMappingURL=createBatcher.d.ts.map
|
|
142
|
+
export declare function createBatcher<TValue, TSelected = {}>(fn: (items: Array<TValue>) => void, options?: SolidBatcherOptions<TValue, TSelected>, selector?: (state: BatcherState<TValue>) => TSelected): SolidBatcher<TValue, TSelected>;
|
|
143
|
+
//#endregion
|
|
@@ -42,7 +42,6 @@ import { Batcher } from "@tanstack/pacer/batcher";
|
|
|
42
42
|
*
|
|
43
43
|
* Available state properties:
|
|
44
44
|
* - `executionCount`: Number of batch executions that have been completed
|
|
45
|
-
* - `isRunning`: Whether the batcher is currently running (not stopped)
|
|
46
45
|
* - `items`: Array of items currently queued for batching
|
|
47
46
|
* - `totalItemsProcessed`: Total number of individual items that have been processed across all batches
|
|
48
47
|
*
|
|
@@ -75,11 +74,11 @@ import { Batcher } from "@tanstack/pacer/batcher";
|
|
|
75
74
|
* }
|
|
76
75
|
* );
|
|
77
76
|
*
|
|
78
|
-
* // Opt-in to track items or
|
|
77
|
+
* // Opt-in to track items or isPending changes (optimized for UI updates)
|
|
79
78
|
* const batcher = createBatcher(
|
|
80
79
|
* (items) => console.log('Processing batch:', items),
|
|
81
80
|
* { maxSize: 5, wait: 2000 },
|
|
82
|
-
* (state) => ({ items: state.items,
|
|
81
|
+
* (state) => ({ items: state.items, isPending: state.isPending })
|
|
83
82
|
* );
|
|
84
83
|
*
|
|
85
84
|
* // Opt-in to track execution metrics changes (optimized for tracking progress)
|
|
@@ -97,11 +96,11 @@ import { Batcher } from "@tanstack/pacer/batcher";
|
|
|
97
96
|
* batcher.addItem('task2');
|
|
98
97
|
*
|
|
99
98
|
* // Control the batcher
|
|
100
|
-
* batcher.
|
|
101
|
-
* batcher.
|
|
99
|
+
* batcher.cancel(); // Cancel the pending timer; queued items are retained
|
|
100
|
+
* batcher.flush(); // Process queued items immediately
|
|
102
101
|
*
|
|
103
102
|
* // Access the selected state (will be empty object {} unless selector provided)
|
|
104
|
-
* const { items,
|
|
103
|
+
* const { items, isPending } = batcher.state();
|
|
105
104
|
* ```
|
|
106
105
|
*/
|
|
107
106
|
function createBatcher(fn, options = {}, selector = () => ({})) {
|
|
@@ -128,5 +127,4 @@ function createBatcher(fn, options = {}, selector = () => ({})) {
|
|
|
128
127
|
}
|
|
129
128
|
|
|
130
129
|
//#endregion
|
|
131
|
-
export { createBatcher };
|
|
132
|
-
//# sourceMappingURL=createBatcher.js.map
|
|
130
|
+
export { createBatcher };
|
|
@@ -73,7 +73,5 @@ import { DebouncerState } from "@tanstack/pacer/debouncer";
|
|
|
73
73
|
* });
|
|
74
74
|
* ```
|
|
75
75
|
*/
|
|
76
|
-
declare function createDebouncedSignal<TValue, TSelected = {}>(value: TValue, initialOptions: SolidDebouncerOptions<Setter<TValue>, TSelected>, selector?: (state: DebouncerState<Setter<TValue>>) => TSelected): [Accessor<TValue>, Setter<TValue>, SolidDebouncer<Setter<TValue>, TSelected>];
|
|
77
|
-
//#endregion
|
|
78
|
-
export { createDebouncedSignal };
|
|
79
|
-
//# sourceMappingURL=createDebouncedSignal.d.ts.map
|
|
76
|
+
export declare function createDebouncedSignal<TValue, TSelected = {}>(value: TValue, initialOptions: SolidDebouncerOptions<Setter<TValue>, TSelected>, selector?: (state: DebouncerState<Setter<TValue>>) => TSelected): [Accessor<TValue>, Setter<TValue>, SolidDebouncer<Setter<TValue>, TSelected>];
|
|
77
|
+
//#endregion
|
|
@@ -64,7 +64,5 @@ import { DebouncerState } from "@tanstack/pacer/debouncer";
|
|
|
64
64
|
* debouncer.cancel(); // Cancel any pending updates
|
|
65
65
|
* ```
|
|
66
66
|
*/
|
|
67
|
-
declare function createDebouncedValue<TValue, TSelected = {}>(value: Accessor<TValue>, initialOptions: SolidDebouncerOptions<Setter<TValue>, TSelected>, selector?: (state: DebouncerState<Setter<TValue>>) => TSelected): [Accessor<TValue>, SolidDebouncer<Setter<TValue>, TSelected>];
|
|
68
|
-
//#endregion
|
|
69
|
-
export { createDebouncedValue };
|
|
70
|
-
//# sourceMappingURL=createDebouncedValue.d.ts.map
|
|
67
|
+
export declare function createDebouncedValue<TValue, TSelected = {}>(value: Accessor<TValue>, initialOptions: SolidDebouncerOptions<Setter<TValue>, TSelected>, selector?: (state: DebouncerState<Setter<TValue>>) => TSelected): [Accessor<TValue>, SolidDebouncer<Setter<TValue>, TSelected>];
|
|
68
|
+
//#endregion
|