npm

electron-bounds
TypeScript icon, indicating that this package has built-in type declarations

1.0.2 • Public • Published

electron-bounds

Persisted window bounds for Electron.

Quickstart

import { watchWindowBounds } from 'electron-bounds'

function createWindow(): void {
  const mainWindow = new BrowserWindow()
  watchWindowBounds(mainWindow)
}

app.whenReady().then(createWindow)

Utils

watchWindowBounds

Watch a window for changes in size and position and persist them in the store.

getWindowBounds

Retrieve the window bounds from the store. Requires a window in case the store is empty.

saveWindowBounds

Persist the bounds of a window in the store.

restoreWindowBounds

Set a window's bounds to the bounds persisted in the store.

getWindowStorePath

Get the path to the store file.

isOffScreen

Check if the stored bounds would escape the screen.

centerWindow

Center a window on the screen.

Package Sidebar

Install

npm i electron-bounds

Weekly Downloads

1

Version

1.0.2

License

MIT

Unpacked Size

24.9 kB

Total Files

10

Last publish

Collaborators

  • cuppachino