MCPcopy Index your code
hub / github.com/nodejs/node-addon-api / CallJS

Method CallJS

napi-inl.h:6642–6659  ·  view source on GitHub ↗

static

Source from the content-addressed store, hash-verified

6640
6641// static
6642inline void ThreadSafeFunction::CallJS(napi_env env,
6643 napi_value jsCallback,
6644 void* /* context */,
6645 void* data) {
6646 if (env == nullptr && jsCallback == nullptr) {
6647 return;
6648 }
6649
6650 details::WrapVoidCallback(env, [&]() {
6651 if (data != nullptr) {
6652 auto* callbackWrapper = static_cast<CallbackWrapper*>(data);
6653 (*callbackWrapper)(env, Function(env, jsCallback));
6654 delete callbackWrapper;
6655 } else if (jsCallback != nullptr) {
6656 Function(env, jsCallback).Call({});
6657 }
6658 });
6659}
6660
6661////////////////////////////////////////////////////////////////////////////////
6662// Async Progress Worker Base class

Callers

nothing calls this directly

Calls 3

WrapVoidCallbackFunction · 0.85
FunctionClass · 0.85
CallMethod · 0.80

Tested by

no test coverage detected