mirror of
https://github.com/tiddly-gittly/TidGi-Desktop.git
synced 2026-01-20 19:41:39 -08:00
refactor: all use ipc.handle instead of .on
This commit is contained in:
parent
8111ea8f36
commit
2059ca78ef
14 changed files with 154 additions and 154 deletions
|
|
@ -66,7 +66,7 @@ class DisplayMedia extends React.Component<DisplayMediaProps, DisplayMediaState>
|
|||
button
|
||||
onClick={() => {
|
||||
const { ipcRenderer } = window.remote;
|
||||
ipcRenderer.send('display-media-selected', source.id);
|
||||
ipcRenderer.invoke('display-media-selected', source.id);
|
||||
}}>
|
||||
<ListItemText primary={source.name} />
|
||||
</ListItem>
|
||||
|
|
@ -78,7 +78,7 @@ class DisplayMedia extends React.Component<DisplayMediaProps, DisplayMediaState>
|
|||
button
|
||||
onClick={() => {
|
||||
const { ipcRenderer } = window.remote;
|
||||
ipcRenderer.send('display-media-selected', source.id);
|
||||
ipcRenderer.invoke('display-media-selected', source.id);
|
||||
}}>
|
||||
<ListItemText primary={source.name} />
|
||||
</ListItem>
|
||||
|
|
|
|||
|
|
@ -28,31 +28,31 @@ const loadListeners = (store: any) => {
|
|||
window.addEventListener('offline', handleOnlineOffline);
|
||||
}
|
||||
|
||||
ipcRenderer.on('create-wiki-progress', (event: any, message: any) => {
|
||||
ipcRenderer.on('create-wiki-progress', (event: Electron.IpcRendererEvent, message: any) => {
|
||||
store.dispatch(setWikiCreationMessage(message));
|
||||
});
|
||||
|
||||
ipcRenderer.on('log', (e: any, message: any) => {
|
||||
ipcRenderer.on('log', (_event: Electron.IpcRendererEvent, message: any) => {
|
||||
if (message) console.log(message); // eslint-disable-line no-console
|
||||
});
|
||||
|
||||
ipcRenderer.on('set-preference', (e: any, name: any, value: any) => {
|
||||
ipcRenderer.on('set-preference', (_event: Electron.IpcRendererEvent, name: any, value: any) => {
|
||||
store.dispatch(setPreference(name, value));
|
||||
});
|
||||
|
||||
ipcRenderer.on('set-system-preference', (e: any, name: any, value: any) => {
|
||||
ipcRenderer.on('set-system-preference', (_event: Electron.IpcRendererEvent, name: any, value: any) => {
|
||||
store.dispatch(setSystemPreference(name, value));
|
||||
});
|
||||
|
||||
ipcRenderer.on('set-workspace', (e: any, id: any, value: any) => {
|
||||
ipcRenderer.on('set-workspace', (_event: Electron.IpcRendererEvent, id: any, value: any) => {
|
||||
store.dispatch(setWorkspace(id, value));
|
||||
});
|
||||
|
||||
ipcRenderer.on('set-workspaces', (e: any, newWorkspaces: any) => {
|
||||
ipcRenderer.on('set-workspaces', (_event: Electron.IpcRendererEvent, newWorkspaces: any) => {
|
||||
store.dispatch(setWorkspaces(newWorkspaces));
|
||||
});
|
||||
|
||||
ipcRenderer.on('set-workspace-meta', (e: any, id: any, value: any) => {
|
||||
ipcRenderer.on('set-workspace-meta', (_event: Electron.IpcRendererEvent, id: any, value: any) => {
|
||||
store.dispatch(setWorkspaceMeta(id, value));
|
||||
});
|
||||
|
||||
|
|
@ -60,19 +60,19 @@ const loadListeners = (store: any) => {
|
|||
store.dispatch(setWorkspaceMetas(newWorkspaceMetas));
|
||||
});
|
||||
|
||||
ipcRenderer.on('update-can-go-back', (e: any, value: any) => {
|
||||
ipcRenderer.on('update-can-go-back', (_event: Electron.IpcRendererEvent, value: any) => {
|
||||
store.dispatch(updateCanGoBack(value));
|
||||
});
|
||||
|
||||
ipcRenderer.on('update-address', (e: any, address: any, edited: any) => {
|
||||
ipcRenderer.on('update-address', (_event: Electron.IpcRendererEvent, address: any, edited: any) => {
|
||||
store.dispatch(updateAddressBarInfo(address, edited));
|
||||
});
|
||||
|
||||
ipcRenderer.on('update-title', (e: any, title: any) => {
|
||||
ipcRenderer.on('update-title', (_event: Electron.IpcRendererEvent, title: any) => {
|
||||
store.dispatch(updateTitle(title));
|
||||
});
|
||||
|
||||
ipcRenderer.on('update-can-go-forward', (e: any, value: any) => {
|
||||
ipcRenderer.on('update-can-go-forward', (_event: Electron.IpcRendererEvent, value: any) => {
|
||||
store.dispatch(updateCanGoForward(value));
|
||||
});
|
||||
|
||||
|
|
@ -85,22 +85,22 @@ const loadListeners = (store: any) => {
|
|||
store.dispatch(closeFindInPage());
|
||||
});
|
||||
|
||||
ipcRenderer.on('update-find-in-page-matches', (e: any, activeMatch: any, matches: any) => {
|
||||
ipcRenderer.on('update-find-in-page-matches', (_event: Electron.IpcRendererEvent, activeMatch: any, matches: any) => {
|
||||
store.dispatch(updateFindInPageMatches(activeMatch, matches));
|
||||
});
|
||||
|
||||
// send back a request with text
|
||||
ipcRenderer.on('request-back-find-in-page', (e: any, forward: any) => {
|
||||
ipcRenderer.on('request-back-find-in-page', (_event: Electron.IpcRendererEvent, forward: any) => {
|
||||
const { open, text } = store.getState().findInPage;
|
||||
if (!open) return;
|
||||
requestFindInPage(text, forward);
|
||||
});
|
||||
|
||||
ipcRenderer.on('should-pause-notifications-changed', (e: any, value: any) => {
|
||||
ipcRenderer.on('should-pause-notifications-changed', (_event: Electron.IpcRendererEvent, value: any) => {
|
||||
store.dispatch(updatePauseNotificationsInfo(value));
|
||||
});
|
||||
|
||||
ipcRenderer.on('update-updater', (e: any, updaterObject: any) => {
|
||||
ipcRenderer.on('update-updater', (_event: Electron.IpcRendererEvent, updaterObject: any) => {
|
||||
store.dispatch(updateUpdater(updaterObject));
|
||||
});
|
||||
|
||||
|
|
@ -108,7 +108,7 @@ const loadListeners = (store: any) => {
|
|||
store.dispatch(updateShouldUseDarkColors(getShouldUseDarkColors()));
|
||||
});
|
||||
|
||||
ipcRenderer.on('is-fullscreen-updated', (e: any, value: any) => {
|
||||
ipcRenderer.on('is-fullscreen-updated', (_event: Electron.IpcRendererEvent, value: any) => {
|
||||
store.dispatch(updateIsFullScreen(value));
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -18,32 +18,32 @@ export const requestCloneSubWiki = (
|
|||
) => ipcRenderer.invoke('clone-sub-wiki', parentFolderLocation, wikiFolderName, mainWikiPath, githubWikiUrl, userInfo, tagName);
|
||||
export const getSubWikiPluginContent = (mainWikiPath: string): Promise<Array<{ tagName: string; folderName: string }>> =>
|
||||
ipcRenderer.invoke('get-sub-wiki-plugin-content', mainWikiPath);
|
||||
export const requestOpen = (uri: string, isDirectory: boolean) => ipcRenderer.send('request-open', uri, !!isDirectory);
|
||||
export const requestShowMessageBox = (message: string, type: string) => ipcRenderer.send('request-show-message-box', message, type);
|
||||
export const requestLoadUrl = (url: string, id: string) => ipcRenderer.send('request-load-url', url, id);
|
||||
export const requestOpen = (uri: string, isDirectory: boolean) => ipcRenderer.invoke('request-open', uri, !!isDirectory);
|
||||
export const requestShowMessageBox = (message: string, type: string) => ipcRenderer.invoke('request-show-message-box', message, type);
|
||||
export const requestLoadUrl = (url: string, id: string) => ipcRenderer.invoke('request-load-url', url, id);
|
||||
|
||||
export const requestGoHome = () => ipcRenderer.send('request-go-home');
|
||||
export const requestGoBack = () => ipcRenderer.send('request-go-back');
|
||||
export const requestGoForward = () => ipcRenderer.send('request-go-forward');
|
||||
export const requestReload = () => ipcRenderer.send('request-reload');
|
||||
export const requestGoHome = () => ipcRenderer.invoke('request-go-home');
|
||||
export const requestGoBack = () => ipcRenderer.invoke('request-go-back');
|
||||
export const requestGoForward = () => ipcRenderer.invoke('request-go-forward');
|
||||
export const requestReload = () => ipcRenderer.invoke('request-reload');
|
||||
|
||||
export const requestQuit = () => ipcRenderer.send('request-quit');
|
||||
export const requestCheckForUpdates = (isSilent: boolean) => ipcRenderer.send('request-check-for-updates', isSilent);
|
||||
export const requestQuit = () => ipcRenderer.invoke('request-quit');
|
||||
export const requestCheckForUpdates = (isSilent: boolean) => ipcRenderer.invoke('request-check-for-updates', isSilent);
|
||||
|
||||
export const requestShowAboutWindow = () => ipcRenderer.send('request-show-about-window');
|
||||
export const requestShowAddWorkspaceWindow = () => ipcRenderer.send('request-show-add-workspace-window');
|
||||
export const requestShowCodeInjectionWindow = (type: string) => ipcRenderer.send('request-show-code-injection-window', type);
|
||||
export const requestShowCustomUserAgentWindow = () => ipcRenderer.send('request-show-custom-user-agent-window');
|
||||
export const requestShowEditWorkspaceWindow = (id: string) => ipcRenderer.send('request-show-edit-workspace-window', id);
|
||||
export const requestShowNotificationsWindow = () => ipcRenderer.send('request-show-notifications-window');
|
||||
export const requestShowPreferencesWindow = (scrollTo: string) => ipcRenderer.send('request-show-preferences-window', scrollTo);
|
||||
export const requestShowProxyWindow = () => ipcRenderer.send('request-show-proxy-window');
|
||||
export const requestShowSpellcheckLanguagesWindow = () => ipcRenderer.send('request-show-spellcheck-languages-window');
|
||||
export const requestShowAboutWindow = () => ipcRenderer.invoke('request-show-about-window');
|
||||
export const requestShowAddWorkspaceWindow = () => ipcRenderer.invoke('request-show-add-workspace-window');
|
||||
export const requestShowCodeInjectionWindow = (type: string) => ipcRenderer.invoke('request-show-code-injection-window', type);
|
||||
export const requestShowCustomUserAgentWindow = () => ipcRenderer.invoke('request-show-custom-user-agent-window');
|
||||
export const requestShowEditWorkspaceWindow = (id: string) => ipcRenderer.invoke('request-show-edit-workspace-window', id);
|
||||
export const requestShowNotificationsWindow = () => ipcRenderer.invoke('request-show-notifications-window');
|
||||
export const requestShowPreferencesWindow = (scrollTo: string) => ipcRenderer.invoke('request-show-preferences-window', scrollTo);
|
||||
export const requestShowProxyWindow = () => ipcRenderer.invoke('request-show-proxy-window');
|
||||
export const requestShowSpellcheckLanguagesWindow = () => ipcRenderer.invoke('request-show-spellcheck-languages-window');
|
||||
|
||||
// Notifications
|
||||
export const requestShowNotification = (options: { title: string; body: string }) => ipcRenderer.send('request-show-notification', options);
|
||||
export const requestUpdatePauseNotificationsInfo = () => ipcRenderer.send('request-update-pause-notifications-info');
|
||||
export const getPauseNotificationsInfo = () => ipcRenderer.sendSync('get-pause-notifications-info');
|
||||
export const requestShowNotification = (options: { title: string; body: string }) => ipcRenderer.invoke('request-show-notification', options);
|
||||
export const requestUpdatePauseNotificationsInfo = () => ipcRenderer.invoke('request-update-pause-notifications-info');
|
||||
export const getPauseNotificationsInfo = () => ipcRenderer.invokeSync('get-pause-notifications-info');
|
||||
|
||||
// Preferences
|
||||
// eslint-disable-next-line no-use-before-define
|
||||
|
|
@ -53,24 +53,24 @@ export interface JsonObject {
|
|||
}
|
||||
interface JsonArray extends Array<JsonValue> {} // tslint:disable-line no-empty-interface
|
||||
export function getPreference<T = JsonValue>(name: string): T {
|
||||
return ipcRenderer.sendSync('get-preference', name);
|
||||
return ipcRenderer.invokeSync('get-preference', name);
|
||||
}
|
||||
export const getPreferences = () => ipcRenderer.sendSync('get-preferences');
|
||||
export const requestSetPreference = (name: string, value: JsonValue) => ipcRenderer.send('request-set-preference', name, value);
|
||||
export const requestResetPreferences = () => ipcRenderer.send('request-reset-preferences');
|
||||
export const requestShowRequireRestartDialog = () => ipcRenderer.send('request-show-require-restart-dialog');
|
||||
export const getPreferences = () => ipcRenderer.invokeSync('get-preferences');
|
||||
export const requestSetPreference = (name: string, value: JsonValue) => ipcRenderer.invoke('request-set-preference', name, value);
|
||||
export const requestResetPreferences = () => ipcRenderer.invoke('request-reset-preferences');
|
||||
export const requestShowRequireRestartDialog = () => ipcRenderer.invoke('request-show-require-restart-dialog');
|
||||
|
||||
// System Preferences
|
||||
export const getSystemPreference = (name: string): JsonValue => ipcRenderer.sendSync('get-system-preference', name);
|
||||
export const getSystemPreferences = (): JsonObject => ipcRenderer.sendSync('get-system-preferences');
|
||||
export const requestSetSystemPreference = (name: string, value: JsonValue) => ipcRenderer.send('request-set-system-preference', name, value);
|
||||
export const getSystemPreference = (name: string): JsonValue => ipcRenderer.invokeSync('get-system-preference', name);
|
||||
export const getSystemPreferences = (): JsonObject => ipcRenderer.invokeSync('get-system-preferences');
|
||||
export const requestSetSystemPreference = (name: string, value: JsonValue) => ipcRenderer.invoke('request-set-system-preference', name, value);
|
||||
|
||||
// Workspace
|
||||
export const countWorkspace = () => ipcRenderer.sendSync('count-workspace');
|
||||
export const getWorkspace = (id: string) => ipcRenderer.sendSync('get-workspace', id);
|
||||
export const getWorkspaces = () => ipcRenderer.sendSync('get-workspaces');
|
||||
export const countWorkspace = () => ipcRenderer.invokeSync('count-workspace');
|
||||
export const getWorkspace = (id: string) => ipcRenderer.invokeSync('get-workspace', id);
|
||||
export const getWorkspaces = () => ipcRenderer.invokeSync('get-workspaces');
|
||||
export const getWorkspaceRemote = (wikiFolderPath: string) => ipcRenderer.invoke('get-workspaces-remote', wikiFolderPath);
|
||||
export const requestClearBrowsingData = () => ipcRenderer.send('request-clear-browsing-data');
|
||||
export const requestClearBrowsingData = () => ipcRenderer.invoke('request-clear-browsing-data');
|
||||
export const requestCreateWorkspace = (
|
||||
name: string,
|
||||
isSubWiki: boolean,
|
||||
|
|
@ -83,49 +83,49 @@ export const requestCreateWorkspace = (
|
|||
tagName: string,
|
||||
) => ipcRenderer.invoke('request-create-workspace', name, isSubWiki, mainWikiToLink, port, homeUrl, gitUrl, picture, transparentBackground, tagName);
|
||||
|
||||
export const requestOpenTiddlerInWiki = (tiddlerName: string) => ipcRenderer.send('request-wiki-open-tiddler', tiddlerName);
|
||||
export const requestWikiSendActionMessage = (actionMessage: string) => ipcRenderer.send('request-wiki-send-action-message', actionMessage);
|
||||
export const requestHibernateWorkspace = (id: string) => ipcRenderer.send('request-hibernate-workspace', id);
|
||||
export const requestOpenUrlInWorkspace = (url: string, id: string) => ipcRenderer.send('request-open-url-in-workspace', url, id);
|
||||
export const requestRealignActiveWorkspace = () => ipcRenderer.send('request-realign-active-workspace');
|
||||
export const requestRemoveWorkspace = (id: string) => ipcRenderer.send('request-remove-workspace', id);
|
||||
export const requestRemoveWorkspacePicture = (id: string) => ipcRenderer.send('request-remove-workspace-picture', id);
|
||||
export const requestSetActiveWorkspace = (id: string) => ipcRenderer.send('request-set-active-workspace', id);
|
||||
export const requestGetActiveWorkspace = () => ipcRenderer.sendSync('request-get-active-workspace');
|
||||
export const requestSetWorkspace = (id: string, options: any) => ipcRenderer.send('request-set-workspace', id, options);
|
||||
export const requestSetWorkspaces = (workspaces: any) => ipcRenderer.send('request-set-workspaces', workspaces);
|
||||
export const requestSetWorkspacePicture = (id: string, picturePath: string) => ipcRenderer.send('request-set-workspace-picture', id, picturePath);
|
||||
export const requestWakeUpWorkspace = (id: string) => ipcRenderer.send('request-wake-up-workspace', id);
|
||||
export const requestOpenTiddlerInWiki = (tiddlerName: string) => ipcRenderer.invoke('request-wiki-open-tiddler', tiddlerName);
|
||||
export const requestWikiSendActionMessage = (actionMessage: string) => ipcRenderer.invoke('request-wiki-send-action-message', actionMessage);
|
||||
export const requestHibernateWorkspace = (id: string) => ipcRenderer.invoke('request-hibernate-workspace', id);
|
||||
export const requestOpenUrlInWorkspace = (url: string, id: string) => ipcRenderer.invoke('request-open-url-in-workspace', url, id);
|
||||
export const requestRealignActiveWorkspace = () => ipcRenderer.invoke('request-realign-active-workspace');
|
||||
export const requestRemoveWorkspace = (id: string) => ipcRenderer.invoke('request-remove-workspace', id);
|
||||
export const requestRemoveWorkspacePicture = (id: string) => ipcRenderer.invoke('request-remove-workspace-picture', id);
|
||||
export const requestSetActiveWorkspace = (id: string) => ipcRenderer.invoke('request-set-active-workspace', id);
|
||||
export const requestGetActiveWorkspace = () => ipcRenderer.invokeSync('request-get-active-workspace');
|
||||
export const requestSetWorkspace = (id: string, options: any) => ipcRenderer.invoke('request-set-workspace', id, options);
|
||||
export const requestSetWorkspaces = (workspaces: any) => ipcRenderer.invoke('request-set-workspaces', workspaces);
|
||||
export const requestSetWorkspacePicture = (id: string, picturePath: string) => ipcRenderer.invoke('request-set-workspace-picture', id, picturePath);
|
||||
export const requestWakeUpWorkspace = (id: string) => ipcRenderer.invoke('request-wake-up-workspace', id);
|
||||
|
||||
// eslint-disable-next-line sonarjs/no-duplicate-string
|
||||
export const getIconPath = () => ipcRenderer.sendSync('get-constant', 'ICON_PATH');
|
||||
export const getReactPath = () => ipcRenderer.sendSync('get-constant', 'REACT_PATH');
|
||||
export const getDesktopPath = () => ipcRenderer.sendSync('get-constant', 'DESKTOP_PATH');
|
||||
export const getLogFolderPath = () => ipcRenderer.sendSync('get-constant', 'LOG_FOLDER');
|
||||
export const getIsDevelopment = () => ipcRenderer.sendSync('get-constant', 'isDev');
|
||||
export const getIconPath = () => ipcRenderer.invokeSync('get-constant', 'ICON_PATH');
|
||||
export const getReactPath = () => ipcRenderer.invokeSync('get-constant', 'REACT_PATH');
|
||||
export const getDesktopPath = () => ipcRenderer.invokeSync('get-constant', 'DESKTOP_PATH');
|
||||
export const getLogFolderPath = () => ipcRenderer.invokeSync('get-constant', 'LOG_FOLDER');
|
||||
export const getIsDevelopment = () => ipcRenderer.invokeSync('get-constant', 'isDev');
|
||||
|
||||
// call path
|
||||
export const getBaseName = (pathString: string): string => ipcRenderer.sendSync('get-basename', pathString);
|
||||
export const getDirectoryName = (pathString: string): string => ipcRenderer.sendSync('get-dirname', pathString);
|
||||
export const getBaseName = (pathString: string): string => ipcRenderer.invokeSync('get-basename', pathString);
|
||||
export const getDirectoryName = (pathString: string): string => ipcRenderer.invokeSync('get-dirname', pathString);
|
||||
|
||||
// Workspace Meta
|
||||
export const getWorkspaceMeta = (id: string) => ipcRenderer.sendSync('get-workspace-meta', id);
|
||||
export const getWorkspaceMetas = () => ipcRenderer.sendSync('get-workspace-metas');
|
||||
export const getWorkspaceMeta = (id: string) => ipcRenderer.invokeSync('get-workspace-meta', id);
|
||||
export const getWorkspaceMetas = () => ipcRenderer.invokeSync('get-workspace-metas');
|
||||
|
||||
// Workspace Git
|
||||
export const initWikiGit = (wikiFolderPath: string, githubRepoUrl: string, userInfo: Object, isMainWiki: boolean) =>
|
||||
ipcRenderer.invoke('request-init-wiki-git', wikiFolderPath, githubRepoUrl, userInfo, isMainWiki);
|
||||
|
||||
// Find In Page
|
||||
export const requestFindInPage = (text: string, forward: boolean) => ipcRenderer.send('request-find-in-page', text, !!forward);
|
||||
export const requestStopFindInPage = (close: boolean) => ipcRenderer.send('request-stop-find-in-page', !!close);
|
||||
export const requestFindInPage = (text: string, forward: boolean) => ipcRenderer.invoke('request-find-in-page', text, !!forward);
|
||||
export const requestStopFindInPage = (close: boolean) => ipcRenderer.invoke('request-stop-find-in-page', !!close);
|
||||
|
||||
// Auth
|
||||
export const requestValidateAuthIdentity = (windowId: string, username: string, password: string) =>
|
||||
ipcRenderer.send('request-validate-auth-identity', windowId, username, password);
|
||||
ipcRenderer.invoke('request-validate-auth-identity', windowId, username, password);
|
||||
|
||||
// Native Theme
|
||||
export const getShouldUseDarkColors = () => ipcRenderer.sendSync('get-should-use-dark-colors');
|
||||
export const getShouldUseDarkColors = () => ipcRenderer.invokeSync('get-should-use-dark-colors');
|
||||
|
||||
// Online Status
|
||||
export const signalOnlineStatusChanged = (online: boolean) => ipcRenderer.send('online-status-changed', online);
|
||||
export const signalOnlineStatusChanged = (online: boolean) => ipcRenderer.invoke('online-status-changed', online);
|
||||
|
|
|
|||
|
|
@ -9,9 +9,9 @@ ipcMain.handle(
|
|||
return pathConstants[key];
|
||||
},
|
||||
);
|
||||
ipcMain.on('get-basename', (event, pathString: string) => {
|
||||
ipcMain.handle('get-basename', (event, pathString: string) => {
|
||||
event.returnValue = path.basename(pathString);
|
||||
});
|
||||
ipcMain.on('get-dirname', (event, pathString: string) => {
|
||||
ipcMain.handle('get-dirname', (event, pathString: string) => {
|
||||
event.returnValue = path.dirname(pathString);
|
||||
});
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ const preloadBindings = function (ipcRenderer: any) {
|
|||
send: (channel: any, data: any) => {
|
||||
const validChannels = [readFileRequest, writeFileRequest];
|
||||
if (validChannels.includes(channel)) {
|
||||
ipcRenderer.send(channel, data);
|
||||
ipcRenderer.invoke(channel, data);
|
||||
}
|
||||
},
|
||||
onReceive: (channel: any, function_: any) => {
|
||||
|
|
@ -41,7 +41,7 @@ const preloadBindings = function (ipcRenderer: any) {
|
|||
// This is the code that will go into the main.js file
|
||||
// in order to set up the ipc main bindings
|
||||
const mainBindings = function (ipcMain: any, browserWindow: any) {
|
||||
ipcMain.on(readFileRequest, (IpcMainEvent: any, arguments_: any) => {
|
||||
ipcMain.handle(readFileRequest, (IpcMainEvent: any, arguments_: any) => {
|
||||
const localeFilePath = path.join(LOCALIZATION_FOLDER, arguments_.filename);
|
||||
fs.readFile(localeFilePath, 'utf8', (error: any, data: any) => {
|
||||
sendToAllWindows(readFileResponse, {
|
||||
|
|
@ -52,7 +52,7 @@ const mainBindings = function (ipcMain: any, browserWindow: any) {
|
|||
});
|
||||
});
|
||||
|
||||
ipcMain.on(writeFileRequest, (IpcMainEvent: any, arguments_: any) => {
|
||||
ipcMain.handle(writeFileRequest, (IpcMainEvent: any, arguments_: any) => {
|
||||
const localeFilePath = path.join(LOCALIZATION_FOLDER, arguments_.filename);
|
||||
const localeFileFolderPath = path.dirname(localeFilePath);
|
||||
// @ts-expect-error ts-migrate(2769) FIXME: No overload matches this call.
|
||||
|
|
|
|||
|
|
@ -44,19 +44,19 @@ const loadListeners = () => {
|
|||
|
||||
|
||||
|
||||
ipcMain.on('request-wiki-open-tiddler', (event, tiddlerName) => {
|
||||
ipcMain.handle('request-wiki-open-tiddler', (event, tiddlerName) => {
|
||||
const browserView = getActiveBrowserView();
|
||||
if (browserView) {
|
||||
browserView.webContents.send('wiki-open-tiddler', tiddlerName);
|
||||
}
|
||||
});
|
||||
ipcMain.on('request-wiki-send-action-message', (event, actionMessage) => {
|
||||
ipcMain.handle('request-wiki-send-action-message', (event, actionMessage) => {
|
||||
const browserView = getActiveBrowserView();
|
||||
if (browserView) {
|
||||
browserView.webContents.send('wiki-send-action-message', actionMessage);
|
||||
}
|
||||
});
|
||||
ipcMain.on('request-open', (_, uri, isDirectory) => {
|
||||
ipcMain.handle('request-open', (_, uri, isDirectory) => {
|
||||
if (isDirectory) {
|
||||
shell.showItemInFolder(uri);
|
||||
} else {
|
||||
|
|
@ -64,14 +64,14 @@ const loadListeners = () => {
|
|||
}
|
||||
});
|
||||
// Find In Page
|
||||
ipcMain.on('request-find-in-page', (_, text, forward) => {
|
||||
ipcMain.handle('request-find-in-page', (_, text, forward) => {
|
||||
// @ts-expect-error ts-migrate(2532) FIXME: Object is possibly 'undefined'.
|
||||
const contents = mainWindow.get().getBrowserView().webContents;
|
||||
contents.findInPage(text, {
|
||||
forward,
|
||||
});
|
||||
});
|
||||
ipcMain.on('request-stop-find-in-page', (_, close) => {
|
||||
ipcMain.handle('request-stop-find-in-page', (_, close) => {
|
||||
const win = mainWindow.get();
|
||||
// @ts-expect-error ts-migrate(2532) FIXME: Object is possibly 'undefined'.
|
||||
const view = win.getBrowserView();
|
||||
|
|
@ -93,16 +93,16 @@ const loadListeners = () => {
|
|||
createWorkspaceView(name, isSubWiki, mainWikiToLink, port, homeUrl, gitUrl, picture, transparentBackground, tagName);
|
||||
createMenu();
|
||||
});
|
||||
ipcMain.on('request-set-active-workspace', (_, id) => {
|
||||
ipcMain.handle('request-set-active-workspace', (_, id) => {
|
||||
if (getWorkspace(id)) {
|
||||
setActiveWorkspaceView(id);
|
||||
createMenu();
|
||||
}
|
||||
});
|
||||
ipcMain.on('request-get-active-workspace', (event) => {
|
||||
ipcMain.handle('request-get-active-workspace', (event) => {
|
||||
event.returnValue = getActiveWorkspace();
|
||||
});
|
||||
ipcMain.on('request-realign-active-workspace', () => {
|
||||
ipcMain.handle('request-realign-active-workspace', () => {
|
||||
const { sidebar, titleBar, navigationBar } = getPreferences();
|
||||
global.sidebar = sidebar;
|
||||
global.titleBar = titleBar;
|
||||
|
|
@ -113,7 +113,7 @@ const loadListeners = () => {
|
|||
realignActiveWorkspaceView();
|
||||
createMenu();
|
||||
});
|
||||
ipcMain.on('request-open-url-in-workspace', (_, url, id) => {
|
||||
ipcMain.handle('request-open-url-in-workspace', (_, url, id) => {
|
||||
if (id) {
|
||||
// if id is defined, switch to that workspace
|
||||
setActiveWorkspaceView(id);
|
||||
|
|
@ -124,32 +124,32 @@ const loadListeners = () => {
|
|||
loadURL(url, activeWorkspace.id);
|
||||
}
|
||||
});
|
||||
ipcMain.on('request-wake-up-workspace', (_, id) => {
|
||||
ipcMain.handle('request-wake-up-workspace', (_, id) => {
|
||||
wakeUpWorkspaceView(id);
|
||||
});
|
||||
ipcMain.on('request-hibernate-workspace', (_, id) => {
|
||||
ipcMain.handle('request-hibernate-workspace', (_, id) => {
|
||||
hibernateWorkspaceView(id);
|
||||
});
|
||||
|
||||
ipcMain.on('request-set-workspace', (_, id, options) => {
|
||||
ipcMain.handle('request-set-workspace', (_, id, options) => {
|
||||
setWorkspaceView(id, options);
|
||||
createMenu();
|
||||
});
|
||||
ipcMain.on('request-set-workspaces', (_, workspaces) => {
|
||||
ipcMain.handle('request-set-workspaces', (_, workspaces) => {
|
||||
setWorkspaceViews(workspaces);
|
||||
createMenu();
|
||||
});
|
||||
ipcMain.on('request-set-workspace-picture', (_, id, picturePath) => {
|
||||
ipcMain.handle('request-set-workspace-picture', (_, id, picturePath) => {
|
||||
setWorkspacePicture(id, picturePath);
|
||||
});
|
||||
ipcMain.on('request-remove-workspace-picture', (_, id) => {
|
||||
ipcMain.handle('request-remove-workspace-picture', (_, id) => {
|
||||
removeWorkspacePicture(id);
|
||||
});
|
||||
|
||||
ipcMain.on('request-load-url', (_, url, id) => {
|
||||
ipcMain.handle('request-load-url', (_, url, id) => {
|
||||
loadURL(url, id);
|
||||
});
|
||||
ipcMain.on('request-go-home', () => {
|
||||
ipcMain.handle('request-go-home', () => {
|
||||
const win = mainWindow.get();
|
||||
if (win !== undefined && win.getBrowserView() !== undefined) {
|
||||
// @ts-expect-error ts-migrate(2531) FIXME: Object is possibly 'null'.
|
||||
|
|
@ -161,7 +161,7 @@ const loadListeners = () => {
|
|||
(win as any).send('update-can-go-forward', contents.canGoForward());
|
||||
}
|
||||
});
|
||||
ipcMain.on('request-go-back', () => {
|
||||
ipcMain.handle('request-go-back', () => {
|
||||
const win = mainWindow.get();
|
||||
if (win !== undefined && win.getBrowserView() !== undefined) {
|
||||
// @ts-expect-error ts-migrate(2531) FIXME: Object is possibly 'null'.
|
||||
|
|
@ -173,7 +173,7 @@ const loadListeners = () => {
|
|||
}
|
||||
}
|
||||
});
|
||||
ipcMain.on('request-go-forward', () => {
|
||||
ipcMain.handle('request-go-forward', () => {
|
||||
const win = mainWindow.get();
|
||||
if (win !== undefined && win.getBrowserView() !== undefined) {
|
||||
// @ts-expect-error ts-migrate(2531) FIXME: Object is possibly 'null'.
|
||||
|
|
@ -185,14 +185,14 @@ const loadListeners = () => {
|
|||
}
|
||||
}
|
||||
});
|
||||
ipcMain.on('request-reload', () => {
|
||||
ipcMain.handle('request-reload', () => {
|
||||
const win = mainWindow.get();
|
||||
if (win !== undefined) {
|
||||
// @ts-expect-error ts-migrate(2531) FIXME: Object is possibly 'null'.
|
||||
win.getBrowserView().webContents.reload();
|
||||
}
|
||||
});
|
||||
ipcMain.on('request-show-message-box', (_, message, type) => {
|
||||
ipcMain.handle('request-show-message-box', (_, message, type) => {
|
||||
dialog
|
||||
// @ts-expect-error ts-migrate(2345) FIXME: Argument of type 'BrowserWindow | undefined' is no... Remove this comment to see the full error message
|
||||
.showMessageBox(mainWindow.get(), {
|
||||
|
|
@ -204,17 +204,17 @@ const loadListeners = () => {
|
|||
})
|
||||
.catch(console.log);
|
||||
});
|
||||
ipcMain.on('create-menu', () => {
|
||||
ipcMain.handle('create-menu', () => {
|
||||
createMenu();
|
||||
});
|
||||
ipcMain.on('request-show-display-media-window', (e) => {
|
||||
ipcMain.handle('request-show-display-media-window', (e) => {
|
||||
const viewId = (BrowserView as any).fromWebContents(e.sender).id;
|
||||
displayMediaWindow.show(viewId);
|
||||
});
|
||||
ipcMain.on('request-quit', () => {
|
||||
ipcMain.handle('request-quit', () => {
|
||||
app.quit();
|
||||
});
|
||||
ipcMain.on('request-check-for-updates', (e, isSilent) => {
|
||||
ipcMain.handle('request-check-for-updates', (e, isSilent) => {
|
||||
// https://github.com/electron-userland/electron-builder/issues/4028
|
||||
if (!autoUpdater.isUpdaterActive()) {
|
||||
return;
|
||||
|
|
@ -260,19 +260,19 @@ const loadListeners = () => {
|
|||
autoUpdater.checkForUpdates();
|
||||
});
|
||||
// Native Theme
|
||||
ipcMain.on('get-should-use-dark-colors', (event) => {
|
||||
ipcMain.handle('get-should-use-dark-colors', (event) => {
|
||||
event.returnValue = nativeTheme.shouldUseDarkColors;
|
||||
});
|
||||
ipcMain.on('request-reload-views-dark-reader', () => {
|
||||
ipcMain.handle('request-reload-views-dark-reader', () => {
|
||||
reloadViewsDarkReader();
|
||||
});
|
||||
// if global.forceNewWindow = true
|
||||
// the next external link request will be opened in new window
|
||||
ipcMain.on('request-set-global-force-new-window', (_, value) => {
|
||||
ipcMain.handle('request-set-global-force-new-window', (_, value) => {
|
||||
(global as any).forceNewWindow = value;
|
||||
});
|
||||
// https://www.electronjs.org/docs/tutorial/online-offline-events
|
||||
ipcMain.on('online-status-changed', (_, online) => {
|
||||
ipcMain.handle('online-status-changed', (_, online) => {
|
||||
if (online) {
|
||||
reloadViewsWebContentsIfDidFailLoad();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -97,7 +97,7 @@ export class Preference {
|
|||
}
|
||||
|
||||
init(): void {
|
||||
ipcMain.on(PreferenceChannel.requestResetPreferences, () => {
|
||||
ipcMain.handle(PreferenceChannel.requestResetPreferences, () => {
|
||||
const preferenceWindow = this.windowService.get(WindowNames.preferences);
|
||||
if (preferenceWindow !== undefined) {
|
||||
dialog
|
||||
|
|
@ -116,7 +116,7 @@ export class Preference {
|
|||
.catch(console.error);
|
||||
}
|
||||
});
|
||||
ipcMain.on(PreferenceChannel.requestClearBrowsingData, () => {
|
||||
ipcMain.handle(PreferenceChannel.requestClearBrowsingData, () => {
|
||||
const availableWindowToShowDialog = this.windowService.get(WindowNames.preferences) ?? this.windowService.get(WindowNames.main);
|
||||
if (availableWindowToShowDialog !== undefined) {
|
||||
dialog
|
||||
|
|
@ -135,13 +135,13 @@ export class Preference {
|
|||
}
|
||||
});
|
||||
|
||||
ipcMain.on(PreferenceChannel.getPreference, (event, name: keyof IPreferences) => {
|
||||
ipcMain.handle(PreferenceChannel.getPreference, (event, name: keyof IPreferences) => {
|
||||
event.returnValue = this.get(name);
|
||||
});
|
||||
ipcMain.on(PreferenceChannel.getPreferences, (event) => {
|
||||
ipcMain.handle(PreferenceChannel.getPreferences, (event) => {
|
||||
event.returnValue = this.cachedPreferences;
|
||||
});
|
||||
ipcMain.on(PreferenceChannel.requestSetPreference, <K extends keyof IPreferences>(_: unknown, key: K, value: IPreferences[K]): void => {
|
||||
ipcMain.handle(PreferenceChannel.requestSetPreference, <K extends keyof IPreferences>(_: unknown, key: K, value: IPreferences[K]): void => {
|
||||
void this.set(key, value);
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,9 +10,9 @@ contextBridge.exposeInMainWorld('remote', {
|
|||
// @ts-expect-error ts-migrate(7019) FIXME: Rest parameter 'arguments_' implicitly has an 'any... Remove this comment to see the full error message
|
||||
invoke: (channel: any, ...arguments_) => ipcRenderer.invoke(channel, ...arguments_),
|
||||
// @ts-expect-error ts-migrate(7019) FIXME: Rest parameter 'arguments_' implicitly has an 'any... Remove this comment to see the full error message
|
||||
send: (channel: any, ...arguments_) => ipcRenderer.send(channel, ...arguments_),
|
||||
send: (channel: any, ...arguments_) => ipcRenderer.invoke(channel, ...arguments_),
|
||||
// @ts-expect-error ts-migrate(7019) FIXME: Rest parameter 'arguments_' implicitly has an 'any... Remove this comment to see the full error message
|
||||
sendSync: (channel: any, ...arguments_) => ipcRenderer.sendSync(channel, ...arguments_),
|
||||
sendSync: (channel: any, ...arguments_) => ipcRenderer.invokeSync(channel, ...arguments_),
|
||||
// @ts-expect-error ts-migrate(7019) FIXME: Rest parameter 'arguments_' implicitly has an 'any... Remove this comment to see the full error message
|
||||
removeListener: (channel: any, ...arguments_) => ipcRenderer.removeListener(channel, ...arguments_),
|
||||
// @ts-expect-error ts-migrate(7019) FIXME: Rest parameter 'arguments_' implicitly has an 'any... Remove this comment to see the full error message
|
||||
|
|
|
|||
|
|
@ -16,10 +16,10 @@ const handleLoaded = (event: string) => {
|
|||
// eslint-disable-next-line no-console
|
||||
console.log(`Preload script is loading on ${event}...`);
|
||||
const loadDarkReader = () => {
|
||||
const shouldUseDarkColor = ipcRenderer.sendSync('get-should-use-dark-colors');
|
||||
const darkReader = ipcRenderer.sendSync('get-preference', 'darkReader');
|
||||
const shouldUseDarkColor = ipcRenderer.invokeSync('get-should-use-dark-colors');
|
||||
const darkReader = ipcRenderer.invokeSync('get-preference', 'darkReader');
|
||||
if (shouldUseDarkColor && darkReader) {
|
||||
const { darkReaderBrightness, darkReaderContrast, darkReaderGrayscale, darkReaderSepia } = ipcRenderer.sendSync('get-preferences');
|
||||
const { darkReaderBrightness, darkReaderContrast, darkReaderGrayscale, darkReaderSepia } = ipcRenderer.invokeSync('get-preferences');
|
||||
enableDarkMode({
|
||||
brightness: darkReaderBrightness,
|
||||
contrast: darkReaderContrast,
|
||||
|
|
@ -34,9 +34,9 @@ const handleLoaded = (event: string) => {
|
|||
ipcRenderer.on('reload-dark-reader', () => {
|
||||
loadDarkReader();
|
||||
});
|
||||
const jsCodeInjection = ipcRenderer.sendSync('get-preference', 'jsCodeInjection');
|
||||
const allowNodeInJsCodeInjection = ipcRenderer.sendSync('get-preference', 'allowNodeInJsCodeInjection');
|
||||
const cssCodeInjection = ipcRenderer.sendSync('get-preference', 'cssCodeInjection');
|
||||
const jsCodeInjection = ipcRenderer.invokeSync('get-preference', 'jsCodeInjection');
|
||||
const allowNodeInJsCodeInjection = ipcRenderer.invokeSync('get-preference', 'allowNodeInJsCodeInjection');
|
||||
const cssCodeInjection = ipcRenderer.invokeSync('get-preference', 'cssCodeInjection');
|
||||
if (jsCodeInjection && jsCodeInjection.trim().length > 0) {
|
||||
if (allowNodeInJsCodeInjection) {
|
||||
try {
|
||||
|
|
@ -80,7 +80,7 @@ const handleLoaded = (event: string) => {
|
|||
new MenuItem({
|
||||
label: i18next.t('ContextMenu.OpenLinkInNewWindow'),
|
||||
click: () => {
|
||||
ipcRenderer.send('request-set-global-force-new-window', true);
|
||||
ipcRenderer.invoke('request-set-global-force-new-window', true);
|
||||
window.open(info.linkURL);
|
||||
},
|
||||
}),
|
||||
|
|
@ -122,16 +122,16 @@ const handleLoaded = (event: string) => {
|
|||
submenu: [
|
||||
{
|
||||
label: i18next.t('ContextMenu.About'),
|
||||
click: () => ipcRenderer.send('request-show-about-window'),
|
||||
click: () => ipcRenderer.invoke('request-show-about-window'),
|
||||
},
|
||||
{ type: 'separator' },
|
||||
{
|
||||
label: i18next.t('ContextMenu.CheckForUpdates'),
|
||||
click: () => ipcRenderer.send('request-check-for-updates'),
|
||||
click: () => ipcRenderer.invoke('request-check-for-updates'),
|
||||
},
|
||||
{
|
||||
label: i18next.t('ContextMenu.Preferences'),
|
||||
click: () => ipcRenderer.send('request-show-preferences-window'),
|
||||
click: () => ipcRenderer.invoke('request-show-preferences-window'),
|
||||
},
|
||||
{ type: 'separator' },
|
||||
{
|
||||
|
|
@ -145,7 +145,7 @@ const handleLoaded = (event: string) => {
|
|||
{ type: 'separator' },
|
||||
{
|
||||
label: i18next.t('ContextMenu.Quit'),
|
||||
click: () => ipcRenderer.send('request-quit'),
|
||||
click: () => ipcRenderer.invoke('request-quit'),
|
||||
},
|
||||
],
|
||||
}),
|
||||
|
|
@ -190,18 +190,18 @@ window.addEventListener('message', (e) => {
|
|||
return;
|
||||
}
|
||||
if (e.data.type === 'get-display-media-id') {
|
||||
ipcRenderer.send('request-show-display-media-window');
|
||||
ipcRenderer.invoke('request-show-display-media-window');
|
||||
}
|
||||
// set workspace to active when its notification is clicked
|
||||
if (e.data.type === 'focus-workspace') {
|
||||
ipcRenderer.send('request-set-active-workspace', e.data.workspaceId);
|
||||
ipcRenderer.invoke('request-set-active-workspace', e.data.workspaceId);
|
||||
}
|
||||
});
|
||||
// Fix Can't show file list of Google Drive
|
||||
// https://github.com/electron/electron/issues/16587
|
||||
// Fix chrome.runtime.sendMessage is undefined for FastMail
|
||||
// https://github.com/atomery/singlebox/issues/21
|
||||
const initialShouldPauseNotifications = ipcRenderer.sendSync('get-pause-notifications-info') != undefined;
|
||||
const initialShouldPauseNotifications = ipcRenderer.invokeSync('get-pause-notifications-info') != undefined;
|
||||
// @ts-expect-error ts-migrate(2339) FIXME: Property 'workspaceId' does not exist on type 'Web... Remove this comment to see the full error message
|
||||
const { workspaceId } = remote.getCurrentWebContents();
|
||||
webFrame.executeJavaScript(`
|
||||
|
|
|
|||
|
|
@ -13,14 +13,14 @@ ipcRenderer.on('wiki-add-tiddler', async (event, title, text, meta) => {
|
|||
`);
|
||||
// wait for fs to be settle
|
||||
await (Promise as any).delay(1000);
|
||||
ipcRenderer.send('wiki-add-tiddler-done');
|
||||
ipcRenderer.invoke('wiki-add-tiddler-done');
|
||||
});
|
||||
// get tiddler text
|
||||
ipcRenderer.on('wiki-get-tiddler-text', async (event, title) => {
|
||||
const tiddlerText = await webFrame.executeJavaScript(`
|
||||
$tw.wiki.getTiddlerText('${title}');
|
||||
`);
|
||||
ipcRenderer.send('wiki-get-tiddler-text-done', tiddlerText);
|
||||
ipcRenderer.invoke('wiki-get-tiddler-text-done', tiddlerText);
|
||||
});
|
||||
// add snackbar to notify user
|
||||
ipcRenderer.on('wiki-sync-progress', (event, message) => {
|
||||
|
|
|
|||
|
|
@ -16,14 +16,14 @@ export class SystemPreference {
|
|||
}
|
||||
|
||||
init(): void {
|
||||
ipcMain.on('get-system-preference', (event, key: keyof IUsedElectionSettings) => {
|
||||
ipcMain.handle('get-system-preference', (event, key: keyof IUsedElectionSettings) => {
|
||||
event.returnValue = this.get(key);
|
||||
});
|
||||
ipcMain.on('get-system-preferences', (event) => {
|
||||
ipcMain.handle('get-system-preferences', (event) => {
|
||||
const preferences = this.getSystemPreferences();
|
||||
event.returnValue = preferences;
|
||||
});
|
||||
ipcMain.on('request-set-system-preference', <K extends keyof IUsedElectionSettings>(_: unknown, key: K, value: IUsedElectionSettings[K]) => {
|
||||
ipcMain.handle('request-set-system-preference', <K extends keyof IUsedElectionSettings>(_: unknown, key: K, value: IUsedElectionSettings[K]) => {
|
||||
this.setSystemPreference(key, value);
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ const create = (id: any) => {
|
|||
ipcMain.removeListener('request-validate-auth-identity', identityValidationListener);
|
||||
});
|
||||
|
||||
ipcMain.on('request-validate-auth-identity', identityValidationListener);
|
||||
ipcMain.handle('request-validate-auth-identity', identityValidationListener);
|
||||
};
|
||||
|
||||
const show = (id: any) => {
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ export class Window {
|
|||
}
|
||||
|
||||
init(): void {
|
||||
ipcMain.on(WindowChannel.requestShowRequireRestartDialog, () => {
|
||||
ipcMain.handle(WindowChannel.requestShowRequireRestartDialog, () => {
|
||||
const availableWindowToShowDialog = this.get(WindowNames.preferences) ?? this.get(WindowNames.main);
|
||||
if (availableWindowToShowDialog !== undefined) {
|
||||
dialog
|
||||
|
|
@ -42,34 +42,34 @@ export class Window {
|
|||
}
|
||||
});
|
||||
|
||||
ipcMain.on(WindowChannel.requestShowCodeInjectionWindow, (_, codeInjectionType: string) => {
|
||||
ipcMain.handle(WindowChannel.requestShowCodeInjectionWindow, (_, codeInjectionType: string) => {
|
||||
// FIXME: make codeInjectionType enum, and find places use this codeInjectionType
|
||||
void this.open(WindowNames.codeInjection, { codeInjectionType });
|
||||
});
|
||||
ipcMain.on(WindowChannel.requestShowCustomUserAgentWindow, () => {
|
||||
ipcMain.handle(WindowChannel.requestShowCustomUserAgentWindow, () => {
|
||||
void this.open(WindowNames.userAgent);
|
||||
});
|
||||
|
||||
ipcMain.on(WindowChannel.requestShowAboutWindow, () => {
|
||||
ipcMain.handle(WindowChannel.requestShowAboutWindow, () => {
|
||||
void this.open(WindowNames.about);
|
||||
});
|
||||
ipcMain.on(WindowChannel.requestShowPreferencesWindow, (_, scrollTo: string) => {
|
||||
ipcMain.handle(WindowChannel.requestShowPreferencesWindow, (_, scrollTo: string) => {
|
||||
// FIXME: make scrollTo enum, and find places use this scrollTo
|
||||
void this.open(WindowNames.preferences, { scrollTo });
|
||||
});
|
||||
ipcMain.on(WindowChannel.requestShowEditWorkspaceWindow, (_, workspaceID: string) => {
|
||||
ipcMain.handle(WindowChannel.requestShowEditWorkspaceWindow, (_, workspaceID: string) => {
|
||||
void this.open(WindowNames.editWorkspace, { workspaceID });
|
||||
});
|
||||
ipcMain.on(WindowChannel.requestShowAddWorkspaceWindow, () => {
|
||||
ipcMain.handle(WindowChannel.requestShowAddWorkspaceWindow, () => {
|
||||
void this.open(WindowNames.addWorkspace);
|
||||
});
|
||||
ipcMain.on(WindowChannel.requestShowNotificationsWindow, () => {
|
||||
ipcMain.handle(WindowChannel.requestShowNotificationsWindow, () => {
|
||||
void this.open(WindowNames.notification);
|
||||
});
|
||||
ipcMain.on(WindowChannel.requestShowProxyWindow, () => {
|
||||
ipcMain.handle(WindowChannel.requestShowProxyWindow, () => {
|
||||
void this.open(WindowNames.proxy);
|
||||
});
|
||||
ipcMain.on(WindowChannel.requestShowSpellcheckLanguagesWindow, () => {
|
||||
ipcMain.handle(WindowChannel.requestShowSpellcheckLanguagesWindow, () => {
|
||||
void this.open(WindowNames.spellcheck);
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,20 +39,20 @@ export class Workspace {
|
|||
|
||||
init(): void {
|
||||
// Workspace Metas
|
||||
ipcMain.on('get-workspace-meta', (event, id) => {
|
||||
ipcMain.handle('get-workspace-meta', (event, id) => {
|
||||
event.returnValue = this.getMetaData(id);
|
||||
});
|
||||
ipcMain.on('get-workspace-metas', (event) => {
|
||||
ipcMain.handle('get-workspace-metas', (event) => {
|
||||
event.returnValue = this.getAllMetaData();
|
||||
});
|
||||
// Workspaces
|
||||
ipcMain.on('count-workspace', (event) => {
|
||||
ipcMain.handle('count-workspace', (event) => {
|
||||
event.returnValue = this.countWorkspaces();
|
||||
});
|
||||
ipcMain.on('get-workspace', (event, id) => {
|
||||
ipcMain.handle('get-workspace', (event, id) => {
|
||||
event.returnValue = this.get(id);
|
||||
});
|
||||
ipcMain.on('get-workspaces', (event) => {
|
||||
ipcMain.handle('get-workspaces', (event) => {
|
||||
event.returnValue = this.getWorkspaces();
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue