on -> once

This commit is contained in:
Feross Aboukhadijeh
2016-06-01 00:10:26 -07:00
parent 8fc61a1c90
commit dac34541d6
4 changed files with 7 additions and 8 deletions

View File

@@ -327,11 +327,11 @@ function buildDarwin (cb) {
}
var dmg = appDmg(dmgOpts)
dmg.on('error', cb)
dmg.once('error', cb)
dmg.on('progress', function (info) {
if (info.type === 'step-begin') console.log(info.title + '...')
})
dmg.on('finish', function (info) {
dmg.once('finish', function (info) {
console.log('OS X: Created dmg.')
cb(null)
})

View File

@@ -55,7 +55,7 @@ function init () {
ipc.init()
app.on('will-finish-launching', function () {
app.once('will-finish-launching', function () {
crashReporter.init()
})
@@ -70,7 +70,7 @@ function init () {
setTimeout(delayedInit, config.DELAYED_INIT)
})
app.on('ipcReady', function () {
app.once('ipcReady', function () {
log('Command line args:', argv)
processArgv(argv)
console.timeEnd('init')
@@ -117,7 +117,6 @@ function onOpen (e, torrentId) {
function onAppOpen (newArgv) {
newArgv = sliceArgv(newArgv)
console.log(newArgv)
if (app.ipcReady) {
log('Second app instance opened, but was prevented:', newArgv)

View File

@@ -17,7 +17,7 @@ function log (...args) {
if (app.ipcReady) {
windows.main.send('log', ...args)
} else {
app.on('ipcReady', () => windows.main.send('log', ...args))
app.once('ipcReady', () => windows.main.send('log', ...args))
}
}
@@ -25,6 +25,6 @@ function error (...args) {
if (app.ipcReady) {
windows.main.send('error', ...args)
} else {
app.on('ipcReady', () => windows.main.send('error', ...args))
app.once('ipcReady', () => windows.main.send('error', ...args))
}
}

View File

@@ -270,7 +270,7 @@ function getTorrentProgress () {
function startServer (infoHash, index) {
var torrent = client.get(infoHash)
if (torrent.ready) startServerFromReadyTorrent(torrent, index)
else torrent.on('ready', () => startServerFromReadyTorrent(torrent, index))
else torrent.once('ready', () => startServerFromReadyTorrent(torrent, index))
}
function startServerFromReadyTorrent (torrent, index, cb) {