d at domenic.me (2015-02-17T17:58:34.852Z)
I would think that a hypothetical `client.get` method would reject when an
error occurred, so that you wouldn't need to attach an "error" handler.
That said, you can also freely mix promises with await and async:
async function fetchish() {
let text = await new Promise((resolve, reject) => {
let client = new Client;
client.on("error", reject);
resolve(client.get());
});
return JSON.parse(text);
}
I would think that a hypothetical `client.get` method would reject when an error occurred, so that you wouldn't need to attach an "error" handler. That said, you can also freely mix promises with await and async: async function fetchish() { let text = await new Promise((resolve, reject) => { let client = new Client; client.on("error", reject); resolve(client.get()); }); return JSON.parse(text); } -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20150203/909ee4d4/attachment.html>