Skip to content

Instantly share code, notes, and snippets.

@diego3g
Last active June 23, 2021 03:05
Show Gist options
  • Save diego3g/7ddd553f8aa806ca3e90873f48dcc49c to your computer and use it in GitHub Desktop.
Save diego3g/7ddd553f8aa806ca3e90873f48dcc49c to your computer and use it in GitHub Desktop.
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