all main modules have init() function

This commit is contained in:
Feross Aboukhadijeh
2016-03-09 15:15:04 -08:00
parent e7d837e813
commit 713c87729a
5 changed files with 31 additions and 24 deletions

View File

@@ -4,10 +4,12 @@ module.exports = {
var debug = require('debug')('webtorrent-app:ipcMain')
var electron = require('electron')
var ipcMain = electron.ipcMain
var menu = require('./menu')
var windows = require('./windows')
var app = electron.app
var ipcMain = electron.ipcMain
function init () {
ipcMain.on('showOpenTorrentFile', function (e) {
menu.showOpenTorrentFile()
@@ -59,7 +61,7 @@ function setAspectRatio (aspectRatio, extraSize) {
// Display string in dock badging area (OS X)
function setBadge (text) {
debug('setBadge %s', text)
if (electron.app.dock) electron.app.dock.setBadge(String(text))
if (app.dock) app.dock.setBadge(String(text))
}
// Show progress bar. Valid range is [0, 1]. Remove when < 0; indeterminate when > 1.