Skip to content

Instantly share code, notes, and snippets.

@estevam5s
Created July 12, 2022 16:16
Show Gist options
  • Save estevam5s/6dd98a6774a3c28f18d1615c4df00db6 to your computer and use it in GitHub Desktop.
Save estevam5s/6dd98a6774a3c28f18d1615c4df00db6 to your computer and use it in GitHub Desktop.
callback.js
function asyncFunction(params, callback, err) {
var response = // requisição assíncrona
if (response.status === true) {
callback(response.data);
} else {
err(response.data);
}
}
asyncFunction(
params,
function(response) {
console.log('Sucesso!');
},
function(err) {
console.log('Erro!');
}
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment