mirror of
https://github.com/revoltchat/revite.git
synced 2024-11-10 01:03:36 -05:00
11 lines
296 B
TypeScript
11 lines
296 B
TypeScript
/**
|
|
* Schedule a task at the end of the Event Loop
|
|
* @param cb Callback
|
|
*/
|
|
export const defer = (cb: () => void) => setTimeout(cb, 0);
|
|
|
|
/**
|
|
* Schedule a task at the end of the second Event Loop
|
|
* @param cb Callback
|
|
*/
|
|
export const chainedDefer = (cb: () => void) => defer(() => defer(cb));
|