Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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.
- Loading branch information