npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

electron-window-plus

v1.3.5

Published

Save and restore window states.

Downloads

12

Readme

electron-window-plus

Linux Build Status Windows Build status Dependency Status devDependency Status

Save and restore window states.

TODO

  • [ ] Add tests for _mainWindowFailed: windowPlus.loadURL failed and did-fail-load.
  • [ ] Add tests for userdata update & restore.
  • [ ] Add test for main window url different to default.
  • [ ] Add tests for windowPlus.restore().
  • [ ] Add other tests...

Why this module?

There are several great module such as electron-window-state, electron-window-manager that doing the same thing. What is the advantage of this module compare to them?

  • Support save and restore multiple windows.
  • Did not introduce new Window class for management.
  • Try to recover to default when restore failed.

Install

npm install --save electron-window-plus

Run Examples:

npm start examples/${name}

Usage

const {app, BrowserWindow} = require('electron');
const windowPlus = require('electron-window-plus');

app.on('ready', function () {
  if ( !windowPlus.restore() ) {
    let win = new BrowserWindow({
      width: 300,
      height: 300,
    });

    windowPlus.manage(win);
    windowPlus.loadURL(win, `file://${__dirname}/index.html`);
  }
});

API Reference

Methods

windowPlus.restore ([defaultUrl, opts])

  • defaultUrl string
  • opts options

windowPlus.manage (win[, uuid, userdata])

  • win BrowserWindow
  • uuid string
  • userdata object

windowPlus.unmanage (win)

  • win BrowserWindow|number

windowPlus.getUserData (win)

  • win BrowserWindow|number

windowPlus.updateUserData (win, userdata)

  • win BrowserWindow|number
  • userdata object

windowPlus.save ()

windowPlus.loadURL (win, url, argv)

  • win BrowserWindow
  • string url
  • object argv

windowPlus.adjust (win, x, y, w, h)

  • win BrowserWindow
  • x number
  • y number
  • w number
  • h number

Try to adjust the window to fit the position and size we give

windowPlus.adjustToMain (win)

  • win BrowserWindow

Adjust window position to make it open in the same display screen as main window

windowPlus.on (eventName, listener)

  • eventName string
  • listener function

Adds an event listener function.

windowPlus.off (eventName, listener)

  • eventName string
  • listener function

Removes an event listener function.

windowPlus.once (eventName, listener)

  • eventName string
  • listener function

Adds a one time event listener function.

Properties

windowPlus.main

The main window.

Events

'manage'

Emit when window get managed via windowPlus.manage().

'unmanage'

Emit when window unmanaged via windowPlus.unmanage().

'save'

Emit when window profile saved.

'main-window-failed'

Emit when main window loading failed.

License

MIT © 2017 Johnny Wu