diff --git a/src/CNodeScriptRuntime.cpp b/src/CNodeScriptRuntime.cpp index 0938c3d3..9a049c3e 100644 --- a/src/CNodeScriptRuntime.cpp +++ b/src/CNodeScriptRuntime.cpp @@ -64,9 +64,18 @@ void CNodeScriptRuntime::OnDispose() } while (uv_loop_alive(uv_default_loop())); }*/ - +#ifdef WIN32 v8::V8::Dispose(); v8::V8::ShutdownPlatform(); +#else + platform->DrainTasks(isolate); + platform->CancelPendingDelayedTasks(isolate); + platform->UnregisterIsolate(isolate); + + isolate->Dispose(); + v8::V8::Dispose(); + platform.release(); +#endif //node::FreePlatform(platform.release()); } diff --git a/src/bindings/Main.cpp b/src/bindings/Main.cpp index 9c95a6da..51f0b4b9 100644 --- a/src/bindings/Main.cpp +++ b/src/bindings/Main.cpp @@ -20,6 +20,21 @@ static void OnClient(const v8::FunctionCallbackInfo& info) resource->SubscribeRemote(*evName, info[1].As(), V8::SourceLocation::GetCurrent(isolate)); } +static void OnceClient(const v8::FunctionCallbackInfo& info) +{ + v8::Isolate* isolate = info.GetIsolate(); + + V8_CHECK(info.Length() == 2, "2 args expected"); + V8_CHECK(info[0]->IsString(), "string expected"); + V8_CHECK(info[1]->IsFunction(), "function expected"); + + V8ResourceImpl* resource = V8ResourceImpl::Get(isolate->GetEnteredContext()); + V8_CHECK(resource, "invalid resource"); + + v8::String::Utf8Value evName(isolate, info[0]); + resource->SubscribeRemote(*evName, info[1].As(), V8::SourceLocation::GetCurrent(isolate), true); +} + static void OffClient(const v8::FunctionCallbackInfo& info) { v8::Isolate* isolate = info.GetIsolate(); @@ -298,6 +313,7 @@ extern V8Module v8Alt("alt", V8Helpers::RegisterFunc(exports, "restartResource", &RestartResource); V8Helpers::RegisterFunc(exports, "onClient", &OnClient); + V8Helpers::RegisterFunc(exports, "onceClient", &OnceClient); V8Helpers::RegisterFunc(exports, "offClient", &OffClient); V8Helpers::RegisterFunc(exports, "emitClient", &EmitClient); diff --git a/src/cpp-sdk b/src/cpp-sdk index 3e8d71e7..11900728 160000 --- a/src/cpp-sdk +++ b/src/cpp-sdk @@ -1 +1 @@ -Subproject commit 3e8d71e76b760e8c97684090fda65782e212eeed +Subproject commit 1190072848fd7fbcf143d36799a57e75199a2c36 diff --git a/src/helpers b/src/helpers index 28feb50f..b3947ad6 160000 --- a/src/helpers +++ b/src/helpers @@ -1 +1 @@ -Subproject commit 28feb50ff84b943900a50622805ac4d429a7ab96 +Subproject commit b3947ad67eb1805b026b24743fb3ac3fb659c81c