Created
September 27, 2017 21:45
-
-
Save JamesTheHacker/1d7bfd6c70bfd9efe2cbd73978e9266d 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 util = require('util'); | |
// Here we use util.promisify to convert the function to a promise | |
const waitAsync = util.promisify(wait); | |
//And here we use the promisified function. Cool huh? | |
waitAsync(1000) | |
.then(data => console.log(data)) | |
.catch(err => console.error(`[Error]: ${err}`)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment