diff options
| author | James Barnett <noreply@jamesbarnett.xyz> | 2018-02-20 21:44:28 +0000 |
|---|---|---|
| committer | James Barnett <noreply@jamesbarnett.xyz> | 2018-02-20 21:44:28 +0000 |
| commit | b81c0f834f7f2285c40cfd57eb2943140025edad (patch) | |
| tree | 2c45b5d844e2a8413f3189090e5f6373226f4fca /instance-manager.js | |
| parent | 52f6783f63d2e2f52e06d14a97b5e00eab8ac1c0 (diff) | |
| download | sql-plus-plus-b81c0f834f7f2285c40cfd57eb2943140025edad.tar.xz sql-plus-plus-b81c0f834f7f2285c40cfd57eb2943140025edad.zip | |
Dynamically create query executors - WIP
Diffstat (limited to 'instance-manager.js')
| -rw-r--r-- | instance-manager.js | 47 |
1 files changed, 21 insertions, 26 deletions
diff --git a/instance-manager.js b/instance-manager.js index 115f359..6a4d019 100644 --- a/instance-manager.js +++ b/instance-manager.js @@ -4,37 +4,32 @@ const { ipcRenderer } = require('electron'); const TabGroup = require("electron-tabs"); const $ = window.jQuery = require("jquery"); -let tabGroup = new TabGroup(); -let tab = tabGroup.addTab({ - title: "Electron", - src: 'file://' + __dirname + '/editor-instance.html', - visible: true, - active: true, - webviewAttributes: {"nodeintegration":true}, - // ready: tab => { - // let webview = tab.webview; - // if (!!webview) { - // webview.addEventListener('dom-ready', () => { - // webview.openDevTools(); - // }) - // } - // } -}); - -let tab2 = tabGroup.addTab({ - title: "Electron", - src: 'file://' + __dirname + '/editor-instance.html', - visible: true, - active: true, - webviewAttributes: { "nodeintegration": true }, -}); +const tabGroup = new TabGroup(); function createNewConnection() { ipcRenderer.send("instanceManager.openNewConnectionDialog"); } -ipcRenderer.on("instanceManager.newConnectionCallback", (event, response) => { - console.log(response); +function registerNewInstance(assignedQueryExecutorId) { + tabGroup.addTab({ + title: "Electron", + src: "file://" + __dirname + "/editor-instance.html", + visible: true, + active: true, + webviewAttributes: {"nodeintegration":true}, + ready: tab => { + let webview = tab.webview; + if (!!webview) { + webview.addEventListener("dom-ready", () => { + webview.send("editorInstance.registerQueryExecutor", assignedQueryExecutorId); + }) + } + } + }); +} + +ipcRenderer.on("instanceManager.registerNewInstance", (event, assignedQueryExecutorId) => { + registerNewInstance(assignedQueryExecutorId); }); |