Skip to content

Instantly share code, notes, and snippets.

@renzocastro
Created October 6, 2018 16:44
Show Gist options
  • Save renzocastro/963689cb7164a8647dd2dcf17eda6d24 to your computer and use it in GitHub Desktop.
Save renzocastro/963689cb7164a8647dd2dcf17eda6d24 to your computer and use it in GitHub Desktop.
Js Promise 1
const pago = new Promise(function (resolve, reject) {
// Esta función se ejecuta al instante
setTimeout(() => {
// resolve('Resuelto');
reject('Rechazado');
}, 5000);
});
const onResolve = data => console.log('RESOLVE', data);
const onReject = err => console.log('REJECT', err);
pago.then(onResolve, onReject);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment