Deprecate app.terminate API.

Users should use app.quit which can shutdown the application gracefuly.
This commit is contained in:
Cheng Zhao 2014-04-10 15:08:14 +08:00
parent 5ead4f655a
commit 538bd1116d
5 changed files with 4 additions and 17 deletions

View 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);

View 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);

View 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

View 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) {

View file

@ -38,7 +38,7 @@ process.on('uncaughtException', function(error) {
});
app.on('window-all-closed', function() {
app.terminate();
app.quit();
});
app.on('ready', function() {