Skip to content

Instantly share code, notes, and snippets.

@giancorzo
Created May 23, 2017 03:24
Show Gist options
  • Save giancorzo/4bdacb8f58c72197b3ee9196c190aea3 to your computer and use it in GitHub Desktop.
Save giancorzo/4bdacb8f58c72197b3ee9196c190aea3 to your computer and use it in GitHub Desktop.
var myPromise = new Promise((resolve, reject) => {
//Instrucciones que se van a ejecutar
if(/* Termino correctamente */) {
resolve('Success!');
} else {
reject('Failure!');
}
});
myPromise.then(function() {
/* hacer algo mas cuando la promesa sea resuelta */
}).catch(function() {
/* capturar el error */
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment