'HandleScope' undeclared identifier
'scope': identifier not found
'GetCurrentContext' is not a member of v8 function
v8::Function::Call : take 3 args does not take 3 args
Help please : I'm using node v12.24.1
//-------------------------------------------------------------------------------------------------------------------//
static Persistent<v8::Function> cb;
void PostMessage(){
Isolate* isolate = Isolate::GetCurrent();
v8::Locker locker(isolate);
HandleScope scope(isolate);
const unsigned argc = 1;
Local<Value> argv[argc] = {
String::NewFromUtf8(isolate, "test") };
Local<v8::Function> PostMessageCb = Local<v8::Function>::New(isolate, cb);
(PostMessageCb)->Call(isolate->GetCurrentContext()->Global(), argc, argv);
}
//-------------------------------------------------------------------------------------------------------------------//
void SetupCallback(const FunctionCallbackInfo<Value>& args) {
Isolate* isolate = Isolate::GetCurrent();
v8::Locker locker(isolate);
HandleScope scope(isolate);
Local<v8::Function> local_cb = Local<v8::Function>::Cast(args[0]);
cb.Reset(isolate, local_cb);
}