UNPKG

@el3um4s/ipc-for-electron-window-controls

Version:

Allow the renderer to close, minimize and maximize the window (for desktop Electron)

34 lines (33 loc) 961 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); /* eslint-disable @typescript-eslint/no-unused-vars */ const ipc_for_electron_1 = require("@el3um4s/ipc-for-electron"); const nameAPI = "windowControls"; // to main const validSendChannel = { minimize: minimize, maximize: maximize, unmaximize: unmaximize, close: close, }; // from Main const validReceiveChannel = []; const windowControls = new ipc_for_electron_1.IPC({ nameAPI, validSendChannel, validReceiveChannel, }); exports.default = windowControls; // Enter here the functions for ElectronJS function minimize(customWindow, event, message) { customWindow.minimize(); } function maximize(customWindow, event, message) { customWindow.maximize(); } function close(customWindow, event, message) { customWindow.destroy(); } function unmaximize(customWindow, event, message) { customWindow.unmaximize(); }