2 ms·
Which mainstream hosters don't? The same ones that only support and will only ever support PHP? > b) having to code a server in javascript's callback/promise h
by warfangle 11y ago
Which mainstream hosters don't? The same ones that only support and will only ever support PHP?
> b) having to code a server in javascript's callback/promise hell.
Don't really see promises as hell, but with latest versions of Node and this neat little library called co, you can write your async code like this:
function doAsyncOne() {} // returns promise
function doAsyncTwo() {} // returns promise
co(function*() {
try {
let [resultOne, resultTwo] = yield [doAsyncOne(), doAsyncTwo()];
}
catch(e) {
// one of the promises rejected, handle it
}
});
Generators as coroutines are the poor man's async/await.