-
-
Save surma/1fde30101820faf494cc89d5feb1a972 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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