public async static Task bootCore(NKScriptContext context, Dictionary<string, object> options)
        {
            // FINALLY LOAD BOOTSTRAP CODE AFTER ALL PLATFORM PLUGINS
            var appjs = await NKStorage.getResourceAsync(typeof(Main), "_nodekit_bootstrapper.js", "lib");
            var script = "function loadbootstrap(){\n" + appjs + "\n}\n" + "loadbootstrap();" + "\n";
            var scriptsource = new NKScriptSource(script, "io.nodekit.core/lib-core/_nodekit_bootstrapper.js", "io.nodekit.core.bootstrapper");
            await context.NKinjectScript(scriptsource);

        }
Beispiel #2
0
        public async static Task bootCore(NKScriptContext context, Dictionary <string, object> options)
        {
            // FINALLY LOAD BOOTSTRAP CODE AFTER ALL PLATFORM PLUGINS
            var appjs = await NKStorage.getResourceAsync(typeof(Main), "_nodekit_bootstrapper.js", "lib");

            var script       = "function loadbootstrap(){\n" + appjs + "\n}\n" + "loadbootstrap();" + "\n";
            var scriptsource = new NKScriptSource(script, "io.nodekit.core/lib-core/_nodekit_bootstrapper.js", "io.nodekit.core.bootstrapper");
            await context.NKinjectScript(scriptsource);
        }
Beispiel #3
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);
        }
Beispiel #4
0
        public async static Task addElectro(NKScriptContext context, Dictionary<string, object> options)
        {
            var appjs = await NKStorage.getResourceAsync(typeof(Renderer), "_nke_renderer.js", "lib_electro");
            var script = "function loadbootstrap(){\n" + appjs + "\n}\n" + "loadbootstrap();" + "\n";
            var scriptsource = new NKScriptSource(script, "io.nodekit.electro/lib-electro/_nke_renderer.js", "io.nodekit.electro.renderer");
            await context.NKinjectScript(scriptsource);

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

            await NKE_IpcRenderer.attachToContext(context, optionsDefault);

        }
        public async static Task addElectro(NKScriptContext context, Dictionary <string, object> options)
        {
            var appjs = await NKStorage.getResourceAsync(typeof(Renderer), "_nke_renderer.js", "lib_electro");

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

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

            await NKE_IpcRenderer.attachToContext(context, optionsDefault);
        }