mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-19 13:06:01 +00:00
removed dependencies on electron remote
This commit is contained in:
@@ -8,9 +8,28 @@ class ElectronApi {
|
||||
this.authorization = args.authorization;
|
||||
}
|
||||
|
||||
send(msg, args) {
|
||||
send(msg, args = null) {
|
||||
this.ipcRenderer.send(msg, args);
|
||||
}
|
||||
|
||||
async showOpenDialog(options) {
|
||||
const res = await this.ipcRenderer.invoke('showOpenDialog', options);
|
||||
return res;
|
||||
}
|
||||
|
||||
async showSaveDialog(options) {
|
||||
const res = await this.ipcRenderer.invoke('showSaveDialog', options);
|
||||
return res;
|
||||
}
|
||||
|
||||
async showItemInFolder(path) {
|
||||
const res = await this.ipcRenderer.invoke('showItemInFolder', path);
|
||||
return res;
|
||||
}
|
||||
|
||||
async openExternal(url) {
|
||||
await this.ipcRenderer.invoke('openExternal', url);
|
||||
}
|
||||
}
|
||||
|
||||
let apiInstance = null;
|
||||
@@ -39,6 +58,10 @@ export function shouldWaitForElectronInitialize() {
|
||||
return !!getIpcRenderer() && !apiInstance;
|
||||
}
|
||||
|
||||
export function isElectronAvailable() {
|
||||
return !!getIpcRenderer();
|
||||
}
|
||||
|
||||
export default function getElectron(): ElectronApi {
|
||||
return apiInstance;
|
||||
// try {
|
||||
|
||||
Reference in New Issue
Block a user