Last active
July 16, 2021 05:58
-
-
Save idandagan1/070ca02e22ad621dbb42296f8afe2d93 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
function processTicksAndRejections() { | |
let tock; | |
do { | |
while (tock = queue.shift()) { | |
... | |
try { | |
const callback = tock.callback; | |
if (tock.args === undefined) { | |
callback(); | |
} else { | |
const args = tock.args; | |
switch (args.length) { | |
case 1: callback(args[0]); break; | |
case 2: callback(args[0], args[1]); break; | |
... | |
default: callback(...args); | |
} | |
} | |
} finally { | |
... | |
} | |
... | |
} | |
runMicrotasks(); | |
} while (!queue.isEmpty() || processPromiseRejections()); | |
... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment