mirror of
https://github.com/electron/electron.git
synced 2026-04-10 03:01:51 -04:00
Add app.exit() API to exit with specified exit status.
This commit is contained in:
@@ -50,6 +50,15 @@ v8::Handle<v8::Value> App::Quit(const v8::Arguments &args) {
|
||||
return v8::Undefined();
|
||||
}
|
||||
|
||||
// static
|
||||
v8::Handle<v8::Value> App::Exit(const v8::Arguments &args) {
|
||||
v8::HandleScope scope;
|
||||
|
||||
exit(args[0]->IntegerValue());
|
||||
|
||||
return v8::Undefined();
|
||||
}
|
||||
|
||||
// static
|
||||
v8::Handle<v8::Value> App::Terminate(const v8::Arguments &args) {
|
||||
v8::HandleScope scope;
|
||||
@@ -100,6 +109,7 @@ 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);
|
||||
|
||||
target->Set(v8::String::NewSymbol("Application"), t->GetFunction());
|
||||
|
||||
@@ -31,6 +31,7 @@ class App : public EventEmitter,
|
||||
static v8::Handle<v8::Value> New(const v8::Arguments &args);
|
||||
|
||||
static v8::Handle<v8::Value> Quit(const v8::Arguments &args);
|
||||
static v8::Handle<v8::Value> Exit(const v8::Arguments &args);
|
||||
static v8::Handle<v8::Value> Terminate(const v8::Arguments &args);
|
||||
static v8::Handle<v8::Value> AppendSwitch(const v8::Arguments &args);
|
||||
static v8::Handle<v8::Value> AppendArgument(const v8::Arguments &args);
|
||||
|
||||
Reference in New Issue
Block a user