Hi,
I am trying to create a C++ function that will be able to call a JS function.
I am using node-gyp with v8 but and I'm not familiar with Napi and I have very basic understanding of the local / context / isolate.
Although, I have already a working exemple of JS calling a C function.
void CallCFunctionWithJS(const FunctionCallbackInfo<Value>& args) {
Isolate* isolate = args.GetIsolate();
function();
args.GetReturnValue().Set(String::NewFromUtf8(isolate, "exit"));
}
The problem is : I try to achieve the opposite.
void CallJSFunctionWithC(void)
{
??? console.log(); ???
}
Is there an easy way to create a function that will allow me to do this.
If not, how can I send Async notification to my JS code when I receive a change of value in C. Thanks alot.