Skip to content

Commit

Permalink
fix: util.promisify(setTimeout)
Browse files Browse the repository at this point in the history
  • Loading branch information
miniak committed Jul 28, 2018
1 parent a6bc803 commit 9201fa7
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lib/common/init.js
@@ -1,4 +1,5 @@
const timers = require('timers')
const util = require('util')

process.atomBinding = require('./atom-binding-setup')(process.binding, process.type)

Expand Down Expand Up @@ -28,6 +29,12 @@ if (process.type === 'browser') {
// recalculate the timeout in browser process.
global.setTimeout = wrapWithActivateUvLoop(timers.setTimeout)
global.setInterval = wrapWithActivateUvLoop(timers.setInterval)

global.setTimeout[util.promisify.custom] = function (timeout) {
return new Promise(resolve => {
global.setTimeout(resolve, timeout)
})
}
}

if (process.platform === 'win32') {
Expand Down

0 comments on commit 9201fa7

Please sign in to comment.