tiny-set-immediate
v1.0.2
Published
A minimal polyfill of setImmediate, for modern browsers using `window.postMessage`, and `MessageChannel` in workers.
Downloads
39,452
Readme
tiny-set-immediate
A minimal polyfill of setImmediate, for modern browsers using window.postMessage
, and MessageChannel
in workers.
If the native functions are available they will be returned instead of a polyfill.
import { setImmediate, clearImmediate } from 'tiny-set-immediate';
const handle = setImmediate(
(...args) => {
console.log(args);
},
[1, 2],
);
clearImmediate(handle);
This implementation does not allow string callbacks, and will not eval it.