Created
June 30, 2015 20:09
-
-
Save andrewbranch/93e1f342f75c36357112 to your computer and use it in GitHub Desktop.
I frequently overcomplicate Promises
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
someAsyncMethod() { | |
return new Promise((resolve, reject) => { | |
somePromiseReturningMethod().then(x => { | |
resolve(doSomethingTo(x)); | |
}); | |
}); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
someAsyncMethod() { | |
return somePromiseReturningMethod().then(x => { | |
return doSomethingTo(x); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment