Socket
Book a DemoInstallSign in
Socket

@jmondi/electron-window

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

@jmondi/electron-window

Electron window wrapper

latest
npmnpm
Version
1.0.4
Version published
Maintainers
1
Created
Source

@jmondi/electron-window

Electron window wrapper

Install

npm install @jmondi/electron-window

Usage

import { app } from "electron";
import { join } from "path";
import { WindowManager } from "@jmondi/electron-window";

const mainWindowUrl = `file://${join(__dirname, "../../index.html")}`;
const windowManager = new WindowManager(mainWindowUrl);

const isMac = process.platform === "darwin";

export async function openMainWindow() {
  await windowManager.createWindow();
}

export function reloadAllWindows() {
  windowManager.reloadAll();
}

async function bootstrap() {
  await app.whenReady();
  await openMainWindow();

  app.on("activate", () => {
    // On OS X it"s common to re-create a window in the app when the
    // dock icon is clicked and there are no other windows open.
    if (isMac) {
      windowManager.focusOrCreate();
    }
  });

  app.on("window-all-closed", () => {
    // On OS X it is common for applications and their menu bar
    // to stay active until the user quits explicitly with Cmd + Q
    if (!isMac) {
      app.quit();
    }
  });
}

bootstrap().catch(console.log);

FAQs

Package last updated on 09 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