Skip to content

Instantly share code, notes, and snippets.

@JamesTheHacker
Created September 27, 2017 21:45
Show Gist options
  • Save JamesTheHacker/1d7bfd6c70bfd9efe2cbd73978e9266d to your computer and use it in GitHub Desktop.
Save JamesTheHacker/1d7bfd6c70bfd9efe2cbd73978e9266d to your computer and use it in GitHub Desktop.
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