Hi.
While working with the library I've noticed that there is no support for js callbacks in .NET code. Function objects supplied to .net code (e.g. as method arguments) are converted to empty dictionaries which obviously are not very useful.
So I've created my own wrapper for functions and would like to share with others. May be someone will find it useful too.
Attached are 2 files (.cpp/.h) that describe managed class JavascriptFunction. It holds v8 handle to js function which can be called from .NET code. To use this new class small patch to JavascriptInterop class should be applied (also attached).
Comments: ** Comment from web user: chillitom **
While working with the library I've noticed that there is no support for js callbacks in .NET code. Function objects supplied to .net code (e.g. as method arguments) are converted to empty dictionaries which obviously are not very useful.
So I've created my own wrapper for functions and would like to share with others. May be someone will find it useful too.
Attached are 2 files (.cpp/.h) that describe managed class JavascriptFunction. It holds v8 handle to js function which can be called from .NET code. To use this new class small patch to JavascriptInterop class should be applied (also attached).
Comments: ** Comment from web user: chillitom **
That's the thing, all ref class objects are always created on the heap. We should also remember these objects are exposed to other CLI languages like C# where the Disposable and Dispose method will be very visible and callable at any time, hence the need to dispose and finalizer. Could actually remove the dispose method and rely on the finalizer alone but I think it might be nice to offer users the opportunity to dispose a little more deterministically, though I don't know whether that makes any sense given that the javascript object won't get free'd until the V8 gc decides to clean up.