BetterDiscordApp-rauenzi/renderer/src/modules/ipc.js

54 lines
1.3 KiB
JavaScript
Raw Normal View History

import {ipcRenderer as ipc} from "electron";
import Events from "./emitter";
import * as IPCEvents from "common/constants/ipcevents";
export default new class IPCRenderer {
constructor() {
ipc.on(IPCEvents.NAVIGATE, () => Events.dispatch("navigate"));
ipc.on(IPCEvents.MAXIMIZE, () => Events.dispatch("maximize"));
ipc.on(IPCEvents.MINIMIZE, () => Events.dispatch("minimize"));
}
openDevTools() {
return ipc.send(IPCEvents.OPEN_DEVTOOLS);
}
closeDevTools() {
return ipc.send(IPCEvents.CLOSE_DEVTOOLS);
}
2022-01-26 18:12:40 +01:00
toggleDevTools() {
return ipc.send(IPCEvents.TOGGLE_DEVTOOLS);
}
relaunch() {
return ipc.send(IPCEvents.RELAUNCH);
}
runScript(script) {
return ipc.invoke(IPCEvents.RUN_SCRIPT, script);
}
openWindow(url, options) {
return ipc.invoke(IPCEvents.OPEN_WINDOW, url, options);
}
inspectElement() {
return ipc.send(IPCEvents.INSPECT_ELEMENT);
}
setMinimumSize(width, height) {
return ipc.send(IPCEvents.MINIMUM_SIZE, width, height);
}
2021-04-06 08:03:08 +02:00
stopDevtoolsWarning() {
return ipc.send(IPCEvents.DEVTOOLS_WARNING);
}
2021-07-09 00:20:28 +02:00
openDialog(options) {
return ipc.invoke(IPCEvents.OPEN_DIALOG, options);
}
};