A nicer way to create promises. No-one can disagree.
const [promise, res, rej] = create_promise();(async () => { console.log(await promise);})();if (Math.random() > 0.5) { res("Hello, world!");} else { rej(new Error());} Copy
const [promise, res, rej] = create_promise();(async () => { console.log(await promise);})();if (Math.random() > 0.5) { res("Hello, world!");} else { rej(new Error());}
Generated using TypeDoc
A nicer way to create promises. No-one can disagree.