From: Cheng Zhao Date: Thu, 10 Apr 2014 07:08:14 +0000 (+0800) Subject: Deprecate app.terminate API. X-Git-Tag: v0.11.8~2 X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=538bd1116d600af9b836dd97e137a9f9eecd1fbd;p=electron.git Deprecate app.terminate API. Users should use app.quit which can shutdown the application gracefuly. --- diff --git a/atom/browser/api/atom_api_app.cc b/atom/browser/api/atom_api_app.cc index d1ec18f8..71ce4730 100644 --- a/atom/browser/api/atom_api_app.cc +++ b/atom/browser/api/atom_api_app.cc @@ -73,16 +73,6 @@ void App::Quit(const v8::FunctionCallbackInfo& args) { Browser::Get()->Quit(); } -// static -void App::Exit(const v8::FunctionCallbackInfo& args) { - exit(args[0]->IntegerValue()); -} - -// static -void App::Terminate(const v8::FunctionCallbackInfo& args) { - Browser::Get()->Terminate(); -} - // static void App::Focus(const v8::FunctionCallbackInfo& args) { Browser::Get()->Focus(); @@ -185,8 +175,6 @@ void App::Initialize(v8::Handle target) { t->SetClassName(v8::String::NewSymbol("Application")); NODE_SET_PROTOTYPE_METHOD(t, "quit", Quit); - NODE_SET_PROTOTYPE_METHOD(t, "exit", Exit); - NODE_SET_PROTOTYPE_METHOD(t, "terminate", Terminate); NODE_SET_PROTOTYPE_METHOD(t, "focus", Focus); NODE_SET_PROTOTYPE_METHOD(t, "getVersion", GetVersion); NODE_SET_PROTOTYPE_METHOD(t, "setVersion", SetVersion); diff --git a/atom/browser/api/atom_api_app.h b/atom/browser/api/atom_api_app.h index a3619963..7b8eaffd 100644 --- a/atom/browser/api/atom_api_app.h +++ b/atom/browser/api/atom_api_app.h @@ -39,8 +39,6 @@ class App : public EventEmitter, static void New(const v8::FunctionCallbackInfo& args); static void Quit(const v8::FunctionCallbackInfo& args); - static void Exit(const v8::FunctionCallbackInfo& args); - static void Terminate(const v8::FunctionCallbackInfo& args); static void Focus(const v8::FunctionCallbackInfo& args); static void GetVersion(const v8::FunctionCallbackInfo& args); static void SetVersion(const v8::FunctionCallbackInfo& args); diff --git a/atom/browser/api/lib/app.coffee b/atom/browser/api/lib/app.coffee index d6c5585a..5762890b 100644 --- a/atom/browser/api/lib/app.coffee +++ b/atom/browser/api/lib/app.coffee @@ -27,8 +27,9 @@ if process.platform is 'darwin' setBadge: bindings.dockSetBadgeText getBadge: bindings.dockGetBadgeText -# Support old event name. +# Be compatible with old API. app.once 'ready', -> app.emit 'finish-launching' +app.terminate = app.exit = app.quit # Only one App object pemitted. module.exports = app diff --git a/atom/browser/default_app/default_app.js b/atom/browser/default_app/default_app.js index a63abbcc..df753a2b 100644 --- a/atom/browser/default_app/default_app.js +++ b/atom/browser/default_app/default_app.js @@ -10,7 +10,7 @@ var menu = null; // Quit when all windows are closed. app.on('window-all-closed', function() { - app.terminate(); + app.quit(); }); app.on('open-url', function(event, url) { diff --git a/spec/static/main.js b/spec/static/main.js index 445a5526..6ec1cf1b 100644 --- a/spec/static/main.js +++ b/spec/static/main.js @@ -38,7 +38,7 @@ process.on('uncaughtException', function(error) { }); app.on('window-all-closed', function() { - app.terminate(); + app.quit(); }); app.on('ready', function() {