New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

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

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

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

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

  • 1.0.4
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

IPC for Electron: Window Controls

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

NPM link: @el3um4s/ipc-for-electron-window-controls

Use @el3um4s/ipc-for-electron and @el3um4s/renderer-for-electron-window-controls to allow communication between Electron and a web page

Install and use the package

To use the package in a project:

npm i @el3um4s/ipc-for-electron @el3um4s/ipc-for-electron-window-controls @el3um4s/renderer-for-electron-window-controls

Then the preload.ts file:

import { generateContextBridge } from "@el3um4s/ipc-for-electron";
import windowControls from "@el3um4s/ipc-for-electron-window-controls";

const listAPI = [windowControls];

generateContextBridge(windowControls);

In the renderer file:

import windowControls from "@el3um4s/renderer-for-electron-window-controls";

windowControls.minimize();
windowControls.maximize();
windowControls.unmaximize();
windowControls.close();

In the renderer you can use:

globalThis.ipc.windowControls.send("minimize", null);
globalThis.ipc.windowControls.send("maximize", null);
globalThis.ipc.windowControls.send("unmaximize", null);
globalThis.ipc.windowControls.send("close", null);

API: Electron Side

  • minimize - Minimize the window
  • maximize - Maximize the window
  • unmaximize - Unmaximize the window
  • close - Close the window

API: Renderer Side - Request

minimize = (options: { apiKey?: string }): void

example:

import windowControls from "@el3um4s/renderer-for-electron-window-controls";

windowControls.minimize();

maximize = (options: { apiKey?: string }): void

example:

import windowControls from "@el3um4s/renderer-for-electron-window-controls";

windowControls.maximize({ apiKey: "my-api-key" });

unmaximize = (options: { apiKey?: string }): void

example:

import windowControls from "@el3um4s/renderer-for-electron-window-controls";

windowControls.unmaximize();

close = (options: { apiKey?: string }): void

example:

import windowControls from "@el3um4s/renderer-for-electron-window-controls";

windowControls.close();

Types

DefaultApiKey

type DefaultApiKey = "ipc";

Keywords

FAQs

Package last updated on 10 Sep 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc