@el3um4s/ipc-for-electron-window-controls
Version:
Allow the renderer to close, minimize and maximize the window (for desktop Electron)
32 lines (31 loc) • 1.14 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const nameAPI = "windowControls";
const defaultApiKey = "ipc";
const minimize = (options) => {
const apiKey = (options === null || options === void 0 ? void 0 : options.apiKey) || defaultApiKey;
const api = globalThis[apiKey][nameAPI];
api.send("minimize", null);
};
const maximize = (options) => {
const apiKey = (options === null || options === void 0 ? void 0 : options.apiKey) || defaultApiKey;
const api = globalThis[apiKey][nameAPI];
api.send("maximize", null);
};
const close = (options) => {
const apiKey = (options === null || options === void 0 ? void 0 : options.apiKey) || defaultApiKey;
const api = globalThis[apiKey][nameAPI];
api.send("close", null);
};
const unmaximize = (options) => {
const apiKey = (options === null || options === void 0 ? void 0 : options.apiKey) || defaultApiKey;
const api = globalThis[apiKey][nameAPI];
api.send("unmaximize", null);
};
const renderer = {
minimize,
maximize,
close,
unmaximize,
};
exports.default = renderer;