Created
December 28, 2015 22:12
-
-
Save brunoskonrad/59e649e344e8c5e29eac to your computer and use it in GitHub Desktop.
Funções de exemplos envoltas em promises
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
const Promised = { | |
getRandom(from, to) { | |
return new Promise((resolve) => { | |
getRandom(from, to, (value) => { | |
resolve(value); | |
}); | |
}); | |
}, | |
sum(x, y) { | |
return new Promise((resolve) => { | |
sum(x, y, (value) => { | |
resolve(value); | |
}); | |
}); | |
}, | |
display(value) { | |
return new Promise((resolve) => { | |
display(value, (success) => { | |
resolve(success); | |
}) | |
}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment