Add app.getVersion() API. Fixes #28.
This commit is contained in:
parent
a79649c43f
commit
81aea6a4b9
2 changed files with 11 additions and 0 deletions
|
@ -92,6 +92,15 @@ v8::Handle<v8::Value> App::Focus(const v8::Arguments &args) {
|
|||
return v8::Undefined();
|
||||
}
|
||||
|
||||
// static
|
||||
v8::Handle<v8::Value> App::GetVersion(const v8::Arguments &args) {
|
||||
v8::HandleScope scope;
|
||||
|
||||
std::string version(Browser::Get()->GetVersion());
|
||||
|
||||
return v8::String::New(version.data(), version.size());
|
||||
}
|
||||
|
||||
// static
|
||||
v8::Handle<v8::Value> App::AppendSwitch(const v8::Arguments &args) {
|
||||
v8::HandleScope scope;
|
||||
|
@ -136,6 +145,7 @@ void App::Initialize(v8::Handle<v8::Object> target) {
|
|||
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);
|
||||
|
||||
target->Set(v8::String::NewSymbol("Application"), t->GetFunction());
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue