From dac34541d678668c1f9d14d9d30bece750dbd0d7 Mon Sep 17 00:00:00 2001 From: Feross Aboukhadijeh Date: Wed, 1 Jun 2016 00:10:26 -0700 Subject: [PATCH] on -> once --- bin/package.js | 4 ++-- main/index.js | 5 ++--- main/log.js | 4 ++-- renderer/webtorrent.js | 2 +- 4 files changed, 7 insertions(+), 8 deletions(-) diff --git a/bin/package.js b/bin/package.js index 3dede2f1..09a2dcea 100755 --- a/bin/package.js +++ b/bin/package.js @@ -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) }) diff --git a/main/index.js b/main/index.js index 2d2c8b93..73dbfe38 100644 --- a/main/index.js +++ b/main/index.js @@ -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) diff --git a/main/log.js b/main/log.js index e8a05924..1c6eb0c6 100644 --- a/main/log.js +++ b/main/log.js @@ -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)) } } diff --git a/renderer/webtorrent.js b/renderer/webtorrent.js index 642f5fa1..3dd5ec2c 100644 --- a/renderer/webtorrent.js +++ b/renderer/webtorrent.js @@ -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) {