3 ms·
Async structures aren't always availablein every environment. Take JS for instance. Without ES6 and Babel, what's the way to write if statements with async?
by EGreg 10y ago
Async structures aren't always availablein every environment. Take JS for instance.
Without ES6 and Babel, what's the way to write if statements with async?
if (x) {
_afterX(null, x);
} else {
getX(_afterX);
}
function _afterX(err, x) {
if (err) return;
// use x
}
// do stuff that doesn't depend on x