UNPKG

1.55 kBMarkdownView Raw
1# Installation
2> `npm install --save @types/setimmediate`
3
4# Summary
5This package contains type definitions for setimmediate (https://github.com/yuzujs/setImmediate#readme).
6
7# Details
8Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/setimmediate.
9## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/setimmediate/index.d.ts)
10````ts
11/**
12 * Schedules a macrotask to run after the current events have been processed.
13 *
14 * Unlike microtasks (scheduled using the Node 0.10+ `process.nextTick` API),
15 * where scheduling additional microtasks inside a microtask will cause them
16 * to be run inside the same microtask checkpoint, any macrotasks scheduled
17 * inside a macrotask will not be executed until the next iteration
18 * of the event loop.
19 *
20 * @param callback The macrotask to schedule.
21 * @param args The arguments to pass to the macrotask callback.
22 *
23 * @return The ID of the macrotask, which can be used to abort
24 * the macrotask with `clearImmediate`.
25 */
26declare function setImmediate<T extends unknown[]>(callback: (...args: T) => void, ...args: T): number;
27
28/**
29 * Aborts the specified macrotask before it's run.
30 *
31 * @param handle The ID of the macrotask to remove from the macrotask queue.
32 */
33declare function clearImmediate(handle: number): void;
34
35````
36
37### Additional Details
38 * Last updated: Tue, 07 Nov 2023 15:11:36 GMT
39 * Dependencies: none
40
41# Credits
42These definitions were written by [ExE Boss](https://github.com/ExE-Boss).
43
\No newline at end of file