@cripty2001/utils 0.0.246 → 0.0.248
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/react-whispr.d.ts +2 -3
- package/dist/react-whispr.js +4 -5
- package/package.json +1 -1
package/dist/react-whispr.d.ts
CHANGED
|
@@ -91,14 +91,13 @@ export declare function useAsync<I, O>(f: (input: I, setProgress: (p: number) =>
|
|
|
91
91
|
/**
|
|
92
92
|
* Like useAsync, but it also automatically re-execute the async function periodically
|
|
93
93
|
*
|
|
94
|
-
* @param f @see useAsync
|
|
95
94
|
* @param data @see useAsync
|
|
96
95
|
* @param interval The interval to re-execute the async function. If null, the async function will not be re-executed.
|
|
97
|
-
* @param
|
|
96
|
+
* @param f @see useAsync
|
|
98
97
|
*
|
|
99
98
|
* @returns @see useAsync
|
|
100
99
|
*/
|
|
101
|
-
export declare function useAsyncPeriodic<I, O>(f: (input: I, setProgress: (p: number) => void, signal: AbortSignal) => Promise<O
|
|
100
|
+
export declare function useAsyncPeriodic<I, O>(data: I, interval: number, f: (input: I, setProgress: (p: number) => void, signal: AbortSignal) => Promise<O>): Dispatcher<any, O>;
|
|
102
101
|
/**
|
|
103
102
|
* Async version of useEffect with debouncing. Executes an async function as a side effect when data changes.
|
|
104
103
|
*
|
package/dist/react-whispr.js
CHANGED
|
@@ -200,22 +200,21 @@ function useAsync(f, data, debouce = 200) {
|
|
|
200
200
|
/**
|
|
201
201
|
* Like useAsync, but it also automatically re-execute the async function periodically
|
|
202
202
|
*
|
|
203
|
-
* @param f @see useAsync
|
|
204
203
|
* @param data @see useAsync
|
|
205
204
|
* @param interval The interval to re-execute the async function. If null, the async function will not be re-executed.
|
|
206
|
-
* @param
|
|
205
|
+
* @param f @see useAsync
|
|
207
206
|
*
|
|
208
207
|
* @returns @see useAsync
|
|
209
208
|
*/
|
|
210
|
-
function useAsyncPeriodic(
|
|
209
|
+
function useAsyncPeriodic(data, interval, f) {
|
|
211
210
|
const timer = useClock(interval);
|
|
212
211
|
const bundle = (0, react_1.useMemo)(() => {
|
|
213
212
|
return {
|
|
214
213
|
data,
|
|
215
214
|
interval
|
|
216
215
|
};
|
|
217
|
-
}, [data, timer
|
|
218
|
-
return useAsync((i, p, s) => f(i.data, p, s), bundle
|
|
216
|
+
}, [data, timer]);
|
|
217
|
+
return useAsync((i, p, s) => f(i.data, p, s), bundle);
|
|
219
218
|
}
|
|
220
219
|
/**
|
|
221
220
|
* Async version of useEffect with debouncing. Executes an async function as a side effect when data changes.
|
package/package.json
CHANGED