@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.
@@ -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 };