Skip to content

Commit

Permalink
Merge branch 'dev' into rc
Browse files Browse the repository at this point in the history
Former-commit-id: b1468bc
  • Loading branch information
martonp96 committed Dec 12, 2020
2 parents 9f2fc7d + aa57f34 commit 13ef138
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 3 deletions.
11 changes: 10 additions & 1 deletion src/CNodeScriptRuntime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
16 changes: 16 additions & 0 deletions src/bindings/Main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,21 @@ static void OnClient(const v8::FunctionCallbackInfo<v8::Value>& info)
resource->SubscribeRemote(*evName, info[1].As<v8::Function>(), V8::SourceLocation::GetCurrent(isolate));
}

static void OnceClient(const v8::FunctionCallbackInfo<v8::Value>& 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::Function>(), V8::SourceLocation::GetCurrent(isolate), true);
}

static void OffClient(const v8::FunctionCallbackInfo<v8::Value>& info)
{
v8::Isolate* isolate = info.GetIsolate();
Expand Down Expand Up @@ -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);

Expand Down
2 changes: 1 addition & 1 deletion src/cpp-sdk
Submodule cpp-sdk updated 1 files
+25 −0 types/BitSet.h
2 changes: 1 addition & 1 deletion src/helpers

0 comments on commit 13ef138

Please sign in to comment.