EGORLETOV
EGORLETOV

Reputation: 39

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

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.

Upvotes: 0

Views: 52

Answers (1)

jmrk
jmrk

Reputation: 40501

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

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

Upvotes: 0

Related Questions