Skip to content

A library to store and restore window sizes and positions for your Electron app

Notifications You must be signed in to change notification settings

xupea/stateful-electron-window

Repository files navigation

stateful-electron-window

Tests NPM version Downloads

A library to store and restore window sizes and positions for your Electron app

Installation

Install with npm:

npm install stateful-electron-window

Usage

import { StatefullBrowserWindow } from 'stateful-electron-window'
const mainWindow = new StatefullBrowserWindow({
    width: 800,
    height: 600,
    webPreferences: {
        preload: path.join(__dirname, 'preload.js')
    },
    supportMaximize: true
})

API

new StatefullBrowserWindow(options)

StatefullBrowserWindow extends BrowserWindow.

options

configFilePath - String

The path where the state file should be written to. Defaults to app.getPath('userData')

configFileName - String

The name of file. Defaults to window-state.json. This is usefull if you want to support multiple windows.

supportMaximize - Boolean

Should we automatically maximize the window, if it was last closed maximized. Defaults to false

About

A library to store and restore window sizes and positions for your Electron app

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published