private async Task onJavaScriptEngineReady()
        {
            await host.NKloadPlugin(new io.nodekit.Samples.Plugin.MyPlugin(), "io.nodekit.Samples.Plugin.MyPlugin");

            await io.nodekit.NKElectro.Main.addElectro(host);

            io.nodekit.NKLogging.log("JS Engine Ready");
        }
Esempio n. 2
0
        public async static Task addElectro(NKScriptContext context, Dictionary <string, object> options)
        {
            var appjs = await NKStorage.getResourceAsync(typeof(Main), "_nke_main.js", "lib_electro");

            var script       = "function loadbootstrap(){\n" + appjs + "\n}\n" + "loadbootstrap();" + "\n";
            var scriptsource = new NKScriptSource(script, "io.nodekit.electro/lib-electro/_nke_main.js", "io.nodekit.electro.main");
            await context.NKinjectScript(scriptsource);

            bool multiProcess = NKOptions.itemOrDefault <bool>(options, "NKS.RemoteProcess", false);

            var optionsDefault = new Dictionary <string, object>
            {
                ["NKS.PluginBridge"] = NKScriptExportType.NKScriptExport
            };

            var optionsMulti = new Dictionary <string, object>
            {
                ["NKS.PluginBridge"]  = NKScriptExportType.NKScriptExport,
                ["NKS.RemoteProcess"] = true
            };

            var optionsMain = new Dictionary <string, object>
            {
                ["NKS.PluginBridge"]        = NKScriptExportType.NKScriptExport,
                ["NKS.MainThread"]          = true,
                ["NKS.MainThreadId"]        = (int)options["NKS.MainThreadId"],
                ["NKS.MainThreadScheduler"] = (TaskScheduler)options["NKS.MainThreadScheduler"]
            };

            await context.NKloadPlugin(typeof(NKE_App), null, optionsDefault);

            if (!multiProcess)
            {
                await NKE_BrowserWindow.attachToContext(context, optionsMain);
            }
            else
            {
                await NKE_BrowserWindow.attachToContext(context, optionsMulti);
            }

            if (!multiProcess)
            {
                await NKE_WebContents.attachToContext(context, optionsMain);
            }
            else
            {
                await NKE_WebContents.attachToContext(context, optionsMulti);
            }

            await NKE_Dialog.attachToContext(context, optionsMain);

            await NKE_IpcMain.attachToContext(context, optionsDefault);

            // NKE_Menu.attachTo(context);
            // NKE_Protocol.attachTo(context);
        }
Esempio n. 3
0
 internal static Task attachToContext(NKScriptContext context, Dictionary <string, object> options)
 {
     return(context.NKloadPlugin(new NKE_Dialog(), null, options));
 }
 internal static Task attachToContext(NKScriptContext context, Dictionary <string, object> options)
 {
     return(context.NKloadPlugin(typeof(NKE_IpcMain), null, options));
 }
 internal static Task attachToContext(NKScriptContext context, Dictionary<string, object> options)
 {
     return context.NKloadPlugin(typeof(NKC_SocketUDP), null, options);
 }
Esempio n. 6
0
        internal static Task attachToContext(NKScriptContext context, Dictionary <string, object> options)
        {
            var principal = new  NKE_IpcRenderer(context.NKid);

            return(context.NKloadPlugin(principal, null, options));
        }
Esempio n. 7
0
 internal static Task attachToContext(NKScriptContext context, Dictionary<string, object> options)
 {
     return context.NKloadPlugin(new NKC_Process(), null, options);
 }
 internal static Task attachToContext(NKScriptContext context, Dictionary<string, object> options)
 {
     var principal = new  NKE_IpcRenderer(context.NKid);
     return context.NKloadPlugin(principal, null, options);
 }
 internal static Task attachToContext(NKScriptContext context, Dictionary <string, object> options)
 {
     startupOptions = options;
     return(context.NKloadPlugin(typeof(NKE_BrowserWindow), null, options));
 }
        //  private NKEventEmitter events = NKEventEmitter.global;

        #region NKScriptExport

        internal static Task attachToContext(NKScriptContext context, Dictionary<string, object> options)
        {
            return context.NKloadPlugin(current, null, options);
        }
 internal static Task attachToContext(NKScriptContext context, Dictionary<string, object> options)
 {
     startupOptions = options;
     return context.NKloadPlugin(typeof(NKE_BrowserWindow), null, options);
 }