-
-
Save hugoalmeidahh/4f443ca9b4c308fd42a55fb2f59e8dda to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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