2.3.0 • Published 4 years ago

win-state v2.3.0

Weekly downloads
14
License
MIT
Repository
gitlab
Last release
4 years ago

Win-State

Save and restore electron apps window size and position.

Install:

$ npm install --save win-state

Usage:

  const {app, BrowserWindow} = require('electron')
  const WinState = require('win-state')

  let mainWindow, childWinState, mainWinState
  function createWindow(e) {
    windowState = new WinState()  
    mainWindow  = new BrowserWindow({
      width:     1200,
      height:    600,
      minWidth:  600,
      minHeight: 400,
      show:      false
    })
    
    windowState.manage(mainWindow, {
      load: `file://${__dirname}/index.html`
    })
    
    if (NODE_ENV === 'dev') mainWindow.webContents.openDevTools() 
    
    childWindow  = new BrowserWindow({
      width:     600,
      height:    600,
      minWidth:  600,
      minHeight: 400,
      show:      false
    })
    
    windowState.manage(childWindow, {
      load: 'http://blog.deep-cloud-nine.us'
    })
    // rest of the code...
  })

This package is possible thanks to:

electron-store

2.3.0

4 years ago

2.2.5

6 years ago

2.2.4

8 years ago

2.2.3

8 years ago

2.2.2

8 years ago

2.2.1

8 years ago

2.1.1

8 years ago

2.1.0

8 years ago

2.0.0

8 years ago

1.0.3

8 years ago

1.0.2

8 years ago