added start / stop events; starting / stopping folder watcher.

This commit is contained in:
Alberto Miranda
2017-03-22 23:21:07 -03:00
parent a6c53d06d2
commit 7f817241ed
5 changed files with 53 additions and 22 deletions

View File

@@ -1,5 +1,6 @@
module.exports = {
init
init,
setModule
}
const electron = require('electron')
@@ -13,6 +14,14 @@ const windows = require('./windows')
// Messages from the main process, to be sent once the WebTorrent process starts
const messageQueueMainToWebTorrent = []
// Will hold modules injected from the app that will be used on fired
// IPC events.
const modules = {}
function setModule (name, module) {
modules[name] = module
}
function init () {
const ipc = electron.ipcMain
@@ -106,6 +115,16 @@ function init () {
thumbar.onPlayerPause()
})
ipc.on('startFolderWatcher', function () {
log('--- Torrent Watcher started')
modules['folderWatcher'].start()
})
ipc.on('stopFolderWatcher', function () {
log('--- Torrent Watcher stop')
modules['folderWatcher'].stop()
})
/**
* Shell
*/