(callback: () => void)
| 31 | * Executes the callback function after the current call stack has been cleared. |
| 32 | */ |
| 33 | export 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 | } |
no test coverage detected