Keyvan M. Sadeghi
1 min readMar 10, 2019

--

Great point 流年! We can use a microtask implementation that uses MutationObserver like nanotask, we’d just need to change apply from:

const apply = (value, state) => { …

to:

const apply = (value, state) => queue(() => { …

Another microtask difference is new Promise(resolve => {throw new Error();}). In browsers, this actually throws the error on next tick, Nancy doesn’t. Instead of:

try {
executor(resolve, reject);
} catch (error) {
reject(error);
}

We can do:

try {
executor(resolve, reject);
} catch (error) {
reject(error);
queue(() => {
throw error;
});
}

--

--

Keyvan M. Sadeghi
Keyvan M. Sadeghi

Written by Keyvan M. Sadeghi

Keyvan is co-founder and CEO at Functionland, an open-source startup working on the intersection of Blockchain and AI

Responses (1)