mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-21 14:06:00 +00:00
replaced executeJavaScript with IPC event
This commit is contained in:
@@ -18,8 +18,6 @@ export default function runCommand(id) {
|
||||
}
|
||||
}
|
||||
|
||||
window['dbgate_runCommand'] = runCommand;
|
||||
|
||||
export function runGroupCommand(group) {
|
||||
const commandsValue = getCommands();
|
||||
const values = Object.values(commandsValue) as GlobalCommand[];
|
||||
@@ -32,3 +30,4 @@ export function findCommand(id) {
|
||||
const command = commandsValue[id];
|
||||
return command;
|
||||
}
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@ import InputTextModal from '../modals/InputTextModal.svelte';
|
||||
import { removeLocalStorage } from '../utility/storageCache';
|
||||
import { showSnackbarSuccess } from '../utility/snackbar';
|
||||
import { apiCall } from '../utility/api';
|
||||
import runCommand from './runCommand';
|
||||
|
||||
function themeCommand(theme: ThemeDefinition) {
|
||||
return {
|
||||
@@ -533,3 +534,8 @@ export function registerFileCommands({
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
const electron = getElectron();
|
||||
if (electron) {
|
||||
electron.addEventListener('run-command', (e, commandId) => runCommand(commandId));
|
||||
}
|
||||
|
||||
@@ -45,15 +45,6 @@ class ElectronApi {
|
||||
}
|
||||
}
|
||||
|
||||
// function initializeElectron(args) {
|
||||
// apiInstance = new ElectronApi(args);
|
||||
// if (window['dbgate_recreateSocket']) {
|
||||
// window['dbgate_recreateSocket']();
|
||||
// }
|
||||
// }
|
||||
|
||||
// window['dbgate_initializeElectron'] = initializeElectron;
|
||||
|
||||
function getIpcRenderer() {
|
||||
if (window['require']) {
|
||||
const electron = window['require']('electron');
|
||||
@@ -62,10 +53,6 @@ function getIpcRenderer() {
|
||||
return null;
|
||||
}
|
||||
|
||||
// export function shouldWaitForElectronInitialize() {
|
||||
// return !!getIpcRenderer() && !apiInstance;
|
||||
// }
|
||||
|
||||
export function isElectronAvailable() {
|
||||
return !!getIpcRenderer();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user