Created
January 24, 2020 19:19
-
-
Save viniceosm/cc4f8d0eba3aa8bc4b207f39f2e301dc to your computer and use it in GitHub Desktop.
in working....
This file contains hidden or 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
<html> | |
<script> | |
var Pessoa = { | |
pesquisa: function (arg1, callback) { | |
callback([ | |
{ | |
nome: 'Vinícius' | |
}, | |
{ | |
nome: 'Amanda' | |
} | |
]); | |
} | |
}; | |
function cbToPromise (fn, nameCallback = 'callback') { | |
// procurar os callback -> 'callback(result111)'.match(/callback\(.*\)/g) | |
} | |
// Chamando a função com callback | |
Pessoa.pesquisa(null, (pessoas) => { | |
console.log('Pessoas:', pessoas); | |
}); | |
// cbToPromise(Pessoa.pesquisa(null)).then(); | |
</script> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment