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;
});
}