ChakraCore.NET JavaScript engine: How to expose C# objects(including properties and variables) to javascript

380 Views Asked by At

I am able to access object methods by following samples provided in https://github.com/JohnMasen/ChakraCore.NET but couldn't find a way to bind variables in the object. Is there a way to bind properties and variables? And, is there a better approach to expose the whole object rather than binding each method?

context.ServiceNode.GetService<IJSValueConverterService>().RegisterProxyConverter<DebugEcho>( //register the object converter
        (binding, instance, serviceNode) =>
        {
           binding.SetMethod<string>("echo", instance.Echo); //js: [object].echo=function(s){[native code]}

    });
0

There are 0 best solutions below