From: Cheng Zhao Date: Thu, 25 Sep 2014 13:48:30 +0000 (+0800) Subject: Emit "exit" event for "process" when quitting. X-Git-Tag: v0.17.0~6^2~32 X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=d55927571149cc1cc9b43ea6caf1e1cf3bcb00b8;p=electron.git Emit "exit" event for "process" when quitting. --- diff --git a/atom/browser/lib/init.coffee b/atom/browser/lib/init.coffee index 1802f464..ddfa5616 100644 --- a/atom/browser/lib/init.coffee +++ b/atom/browser/lib/init.coffee @@ -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' diff --git a/atom/renderer/lib/init.coffee b/atom/renderer/lib/init.coffee index 5ae2e11a..3fb4ceaa 100644 --- a/atom/renderer/lib/init.coffee +++ b/atom/renderer/lib/init.coffee @@ -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 =