MCPcopy Create free account
hub / github.com/middleapi/orpc / defer

Function defer

packages/shared/src/function.ts:33–43  ·  view source on GitHub ↗
(callback: () => void)

Source from the content-addressed store, hash-verified

31 * Executes the callback function after the current call stack has been cleared.
32 */
33export function defer(callback: () => void): void {
34 if (typeof setTimeout === 'function') {
35 setTimeout(callback, 0)
36 }
37 else {
38 Promise.resolve()
39 .then(() => Promise.resolve()
40 .then(() => Promise.resolve()
41 .then(callback)))
42 }
43}

Callers 3

initMethod · 0.90
initMethod · 0.90
function.test.tsFile · 0.90

Calls 1

thenMethod · 0.80

Tested by

no test coverage detected