Skip to content

Instantly share code, notes, and snippets.

@phil-kahrl
Created August 16, 2018 19:57
Show Gist options
  • Save phil-kahrl/95d9dac017cb5d656107577bcc91fa3d to your computer and use it in GitHub Desktop.
Save phil-kahrl/95d9dac017cb5d656107577bcc91fa3d to your computer and use it in GitHub Desktop.
Callback and promise
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