How can i pass callback as argument to function and execute it from c++ side?

54 Views Asked by At

When i embedded chakracore i could get argument which contains passed callback and execute this function with my own passed arguments to callback. How can i do it in v8 engine?

js example readFile("C:/test.txt", (data, err) => {console.log(data, err)})

I tried to google this problem but didn't find answers.

1

There are 1 best solutions below

0
jmrk On

v8::Function has a Call(...) method.

See the V8 samples for various examples how to use the V8 API.