Skip to content

Latest commit

 

History

History
49 lines (32 loc) · 1.41 KB

README.md

File metadata and controls

49 lines (32 loc) · 1.41 KB

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