Skip to content

Instantly share code, notes, and snippets.

@surma
Created Feb 23, 2021
Embed
What would you like to do?
const task = cb => {
const mc = new MessageChannel();
mc.port1.postMessage(null);
mc.port2.addEventListener("message", () => {
cb();
}, {once: true});
mc.port2.start();
}
const microtask = cb => queueMicrotask(cb);
// Only available in node
// const nanotask = cb => process.nextTick(cb);
const synchronous = cb => cb();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment