Last active
December 11, 2017 16:25
-
-
Save diego3g/2add292924b7e2fdf061b05f5d59ab39 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
const timeout = ms => new Promise((resolve, reject) => | |
setTimeout(reject, ms, { timeout: true }); | |
); | |
Promise.race([api.get('/users/diego3g'), timeout(2000)]) | |
.then(resp => console.log(resp)) | |
.catch(err => console.log(err)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment