Hello Balazs,
Thanks for your kind words! Unfortunately there's no detailed documentation beyond the code itself.
ClearScript's V8 binding consists of several layers. The best way to understand it is to follow a code path from V8 to a target host object. Some tools you might find helpful are ClearScriptConsole, which provides a script command line with access to the core .NET class library, and the Visual Studio debugger, which lets you step through both native and managed code in the same process.
Here are some notes to get you started.
Interception is the key V8 mechanism that enables host object access from script code. A script talks to a host object through a native JavaScript proxy that invokes native ClearScript callbacks for all property access. You can find the callback methods in the
If you set a breakpoint there, you can step through the code as it makes its way to the managed side and eventually ends up in
Good luck, and please let us know if you have more questions!
Thanks for your kind words! Unfortunately there's no detailed documentation beyond the code itself.
ClearScript's V8 binding consists of several layers. The best way to understand it is to follow a code path from V8 to a target host object. Some tools you might find helpful are ClearScriptConsole, which provides a script command line with access to the core .NET class library, and the Visual Studio debugger, which lets you step through both native and managed code in the same process.
Here are some notes to get you started.
Interception is the key V8 mechanism that enables host object access from script code. A script talks to a host object through a native JavaScript proxy that invokes native ClearScript callbacks for all property access. You can find the callback methods in the
V8ContextImpl
class; e.g., GetHostObjectProperty()
, SetHostObjectProperty()
, etc.If you set a breakpoint there, you can step through the code as it makes its way to the managed side and eventually ends up in
HostItem
, the managed wrapper for all exposed host resources. HostItem
then fulfills the request using a variety of APIs such as reflection, the C# Runtime Binder, the .NET dynamic infrastructure, COM interop, etc. It has a lot of plumbing to handle a variety of binding scenarios.Good luck, and please let us know if you have more questions!