2021-03-06 09:30:16 +01:00
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
2021-03-06 09:30:16 +01:00
|
|
|
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);
|
|
|
|
}
|
2021-04-03 05:16:23 +02:00
|
|
|
|
|
|
|
inspectElement() {
|
2021-04-03 06:17:55 +02:00
|
|
|
return ipc.send(IPCEvents.INSPECT_ELEMENT);
|
|
|
|
}
|
|
|
|
|
|
|
|
setMinimumSize(width, height) {
|
|
|
|
return ipc.send(IPCEvents.MINIMUM_SIZE, width, height);
|
2021-04-03 05:16:23 +02:00
|
|
|
}
|
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);
|
|
|
|
}
|
2021-03-06 09:30:16 +01:00
|
|
|
};
|