Skip to content

Commit 58e4cec

Browse files
committed
feat: C++/JS proxy functions
Define JS proxy types for functions to allow complete interoperability between C++ and JS functions. When accessing a JS function in C++, the dom::Function contains a reference to the Scope variable with the JS function. The JS execution context will evaluate this function in JS and convert the result back to dom::Value. When accessing a C++ function in JS, the JS object will contain a hidden buffer to store a copy of the original dom::Function. When JS executes the function, it will get the original dom::Function from this hidden buffer, convert all arguments to dom::Value, call the original dom::Function, and push the dom::Value result to the stack. When the function is garbage collected, the object finalization callback destroys the function stored in the buffer.
1 parent da84105 commit 58e4cec

File tree

2 files changed

+305
-66
lines changed

2 files changed

+305
-66
lines changed

0 commit comments

Comments
 (0)