rogerwang/node-webkit — pull request #2006 by mrfabbri (2014-06-25 17:18:20+00:00)
Title: [OSX] Handle system application termination attempts

Implements `applicationShouldTerminate` method inside the `AppController`
(`NSApplicationDelegate`) to (catch and) handle all application termination
requests (e.g `Quit` in OS X Dock). Application termination is delegated to per
window `close`/`quit` event handlers (or default window behaviour) via
`App::CloseAllWindows` (called with the `quit` flag set): application terminates
when/if all window close.

Without an `applicationShouldTerminate` implementation the application
terminates immediately (e.g. with `Quit` in OS X Dock) without permitting an
orderly shutdown and emitting any `close`/`quit` events.

Fixes rogerwang/node-webkit#430 and also resolves rogerwang/node-webkit#924