mirror of
https://github.com/anyproto/anytype-ts.git
synced 2025-06-08 05:57:02 +09:00
fixes
This commit is contained in:
parent
7eecb38c60
commit
1ee54cddf2
1 changed files with 11 additions and 4 deletions
15
electron.js
15
electron.js
|
@ -125,14 +125,21 @@ function createWindow () {
|
|||
MenuManager.initTray();
|
||||
|
||||
ipcMain.handle('Api', (e, cmd, args) => {
|
||||
args = args || [];
|
||||
args.unshift(BrowserWindow.fromId(e.sender.id));
|
||||
|
||||
const Api = require('./electron/js/api.js');
|
||||
const win = BrowserWindow.fromId(e.sender.id);
|
||||
|
||||
if (!win) {
|
||||
console.error('[Api] window is not defined', cmd, e.sender.id);
|
||||
return;
|
||||
};
|
||||
|
||||
args = args || [];
|
||||
args.unshift(win);
|
||||
|
||||
if (Api[cmd]) {
|
||||
Api[cmd].apply(Api, args);
|
||||
} else {
|
||||
console.error('Api method not defined:', cmd, Api);
|
||||
console.error('[Api] method not defined:', cmd);
|
||||
};
|
||||
});
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue