]> khamidou — GitHub mirrors - electron.git/commitdiff
Deprecate app.terminate API.
authorCheng Zhao <zcbenz@gmail.com>
Thu, 10 Apr 2014 07:08:14 +0000 (15:08 +0800)
committerCheng Zhao <zcbenz@gmail.com>
Thu, 10 Apr 2014 07:08:14 +0000 (15:08 +0800)
Users should use app.quit which can shutdown the application gracefuly.

atom/browser/api/atom_api_app.cc
atom/browser/api/atom_api_app.h
atom/browser/api/lib/app.coffee
atom/browser/default_app/default_app.js
spec/static/main.js

index d1ec18f8e03d281a7a1d73342dcbd9cc2c1569a3..71ce4730f0bc5891bd46ff996da80a07ff30b3da 100644 (file)
@@ -73,16 +73,6 @@ void App::Quit(const v8::FunctionCallbackInfo<v8::Value>& args) {
   Browser::Get()->Quit();
 }
 
-// static
-void App::Exit(const v8::FunctionCallbackInfo<v8::Value>& args) {
-  exit(args[0]->IntegerValue());
-}
-
-// static
-void App::Terminate(const v8::FunctionCallbackInfo<v8::Value>& args) {
-  Browser::Get()->Terminate();
-}
-
 // static
 void App::Focus(const v8::FunctionCallbackInfo<v8::Value>& args) {
   Browser::Get()->Focus();
@@ -185,8 +175,6 @@ void App::Initialize(v8::Handle<v8::Object> 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);
index a36199634e113cf3457a3faec4cc73c75fdff6dc..7b8eaffde00fa002e1e0ed9552c67d545a73777e 100644 (file)
@@ -39,8 +39,6 @@ class App : public EventEmitter,
   static void New(const v8::FunctionCallbackInfo<v8::Value>& args);
 
   static void Quit(const v8::FunctionCallbackInfo<v8::Value>& args);
-  static void Exit(const v8::FunctionCallbackInfo<v8::Value>& args);
-  static void Terminate(const v8::FunctionCallbackInfo<v8::Value>& args);
   static void Focus(const v8::FunctionCallbackInfo<v8::Value>& args);
   static void GetVersion(const v8::FunctionCallbackInfo<v8::Value>& args);
   static void SetVersion(const v8::FunctionCallbackInfo<v8::Value>& args);
index d6c5585ac434d3d3d1de0ea0c1c92532a3a7ce43..5762890b45f5d4ff24cc63853cdd4610082c9a73 100644 (file)
@@ -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
index a63abbcc7fa1ec3283ddc72b0da2ef79aa120b52..df753a2b27b94bedcd09d850c6b3655c1430c900 100644 (file)
@@ -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) {
index 445a5526c612d3db5987daf53a980dbba8ed2c05..6ec1cf1b892bd5144ec74a7af7f804494fc57f15 100644 (file)
@@ -38,7 +38,7 @@ process.on('uncaughtException', function(error) {
 });
 
 app.on('window-all-closed', function() {
-  app.terminate();
+  app.quit();
 });
 
 app.on('ready', function() {