@sohanemon/utils 6.4.7 → 7.0.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/components/index.cjs +1 -1
- package/dist/components/index.d.cts +4 -4
- package/dist/components/index.js +1 -1
- package/dist/functions-CUn5JJn0.cjs +11 -0
- package/dist/functions-NBY7C4F1.js +11 -0
- package/dist/hooks/index.cjs +1 -1
- package/dist/hooks/index.d.cts +1 -1
- package/dist/hooks/index.d.ts +1 -1
- package/dist/hooks/index.js +1 -1
- package/dist/hooks-D0giyGCY.cjs +1 -0
- package/dist/hooks-DftaZyen.js +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +4 -1247
- package/dist/index.d.ts +174 -492
- package/dist/index.js +1 -1
- package/package.json +4 -1
- package/dist/functions-BXM8RFi-.js +0 -11
- package/dist/functions-HUrMwWSC.cjs +0 -11
- package/dist/hooks-CSmMIrB4.js +0 -1
- package/dist/hooks-oAfGz4K9.cjs +0 -1
- package/dist/index-CG2oc6F7.d.ts +0 -970
- package/dist/schedule-BqFAJlSO.d.cts +0 -43
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
//#region src/functions/schedule.d.ts
|
|
2
|
-
/**
|
|
3
|
-
* A task function that can be synchronous or asynchronous.
|
|
4
|
-
*/
|
|
5
|
-
type Task = () => Promise<void> | void;
|
|
6
|
-
/**
|
|
7
|
-
* Options for configuring the schedule function.
|
|
8
|
-
*/
|
|
9
|
-
interface ScheduleOpts {
|
|
10
|
-
/** Number of retry attempts on failure. Defaults to 0. */
|
|
11
|
-
retry?: number;
|
|
12
|
-
/** Delay in milliseconds between retries. Defaults to 0. */
|
|
13
|
-
delay?: number;
|
|
14
|
-
/** Maximum time in milliseconds to wait for the task to complete. */
|
|
15
|
-
timeout?: number;
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* Runs a function asynchronously in the background without blocking the main thread.
|
|
19
|
-
*
|
|
20
|
-
* Executes the task immediately using setTimeout, with optional retry logic on failure.
|
|
21
|
-
* Useful for non-critical operations like analytics, logging, or background processing.
|
|
22
|
-
* Logs execution time and retry attempts to the console.
|
|
23
|
-
*
|
|
24
|
-
* @param task - The function to execute asynchronously
|
|
25
|
-
* @param options - Configuration options for retries and timing
|
|
26
|
-
*
|
|
27
|
-
* @example
|
|
28
|
-
* ```ts
|
|
29
|
-
* // Simple background task
|
|
30
|
-
* schedule(() => {
|
|
31
|
-
* console.log('Background work done');
|
|
32
|
-
* });
|
|
33
|
-
*
|
|
34
|
-
* // Task with retry on failure
|
|
35
|
-
* schedule(
|
|
36
|
-
* () => sendAnalytics(),
|
|
37
|
-
* { retry: 3, delay: 1000 }
|
|
38
|
-
* );
|
|
39
|
-
* ```
|
|
40
|
-
*/
|
|
41
|
-
declare function schedule(task: Task, options?: ScheduleOpts): void;
|
|
42
|
-
//#endregion
|
|
43
|
-
export { Task as n, schedule as r, ScheduleOpts as t };
|