Emit "exit" event for "process" when quitting.

This commit is contained in:
Cheng Zhao 2014-09-25 21:48:30 +08:00
parent 909ff085ac
commit d559275711
2 changed files with 8 additions and 0 deletions

View file

@ -52,6 +52,10 @@ setImmediate ->
detail: message
buttons: ['OK']
# Emit 'exit' event on quit.
require('app').on 'quit', ->
process.emit 'exit'
# Load the RPC server.
require './rpc-server.js'

View file

@ -24,6 +24,10 @@ require path.resolve(__dirname, '..', '..', 'common', 'lib', 'init.js')
global.require = require
global.module = module
# Emit the 'exit' event when page is unloading.
window.addEventListener 'unload', ->
process.emit 'exit'
# Set the __filename to the path of html file if it's file: or asar: protocol.
if window.location.protocol in ['file:', 'asar:']
pathname =