Beispiel #1
0
        public PluginManager(ChakraContext context, LoadPluginInstallerFunction loadPluginInstallerCallback)
        {
            context.GlobalObject.Binding.SetFunction <string, JavaScriptValue>("RequireNative", (name) =>
            {
                var plugin = loadPluginInstallerCallback(name);
                var stub   = createStubValue();
                plugin.Install(stub);
                return(stub.ReferenceValue);
            });
            var jsvalue = context.ServiceNode.GetService <IJSValueService>().CreateObject();

            apiContainer = new JSValue(context.GlobalObject.ServiceNode, jsvalue);
            context.GlobalObject.WriteProperty(API_OBJECT_NAME, apiContainer);
        }
 public static JavaScriptHostingConfig AddPlugin(this JavaScriptHostingConfig config, LoadPluginInstallerFunction loadCallback)
 {
     config.PluginLoaders.Add(loadCallback);
     return(config);
 }