aabtop / reify

Reify lets you embed a customized TypeScript runtime within a C++ application.
MIT License
6 stars 0 forks source link

Add support for calling Reify functions with parameters. #12

Open aabtop opened 4 years ago

aabtop commented 4 years ago

Currently we're able to call functions that take no parameters, but we don't support calling Reify functions that require parameters. This would be useful, for example, to enable functions that take a time parameter to express animations.

In order for this to work, we'll need a system for converting from C++ Immut Ref types to V8 bindings types. We have logic for going the other direction already to support function return values.

We will need to parse and understand function type signatures that contain parameters, then convert these parameters to V8 bindings types, and then setup V8 bindings functionality to invoke the function calls with the appropriate parameters.

In order to maintain efficiency, we will want to keep a registry of C++ Immut Ref objects known to be associated with V8 objects, so that we can avoid re-creating these. For example, if a V8 function returns an object, and we then pass that as a parameter to another V8 function, it should not have to convert it to a V8 object because it already exists as a V8 object.