Skip to content

Instantly share code, notes, and snippets.

View hadisinaee's full-sized avatar
:octocat:
I may be slow to respond.

Hadi hadisinaee

:octocat:
I may be slow to respond.
View GitHub Profile
@hadisinaee
hadisinaee / protips.js
Created April 26, 2017 15:58 — forked from nolanlawson/protips.js
Promise protips - stuff I wish I had known when I started with Promises
// Promise.all is good for executing many promises at once
Promise.all([
promise1,
promise2
]);
// Promise.resolve is good for wrapping synchronous code
Promise.resolve().then(function () {
if (somethingIsNotRight()) {
throw new Error("I will be rejected asynchronously!");