Created
August 16, 2018 19:57
-
-
Save phil-kahrl/95d9dac017cb5d656107577bcc91fa3d to your computer and use it in GitHub Desktop.
Callback and promise
This file contains hidden or 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
const params = {key: 'value'} | |
const successCallback = () => {console.log('success'}) | |
const failureCallback = () => {console.log('failure'}) | |
// callback pattern | |
doSomething(params, successCallback, failureCallback) | |
//Promise pattern | |
doSomething(params).then(successCallback).catch(failureCallback) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment