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 🙏

© 2026 – Pkg Stats / Ryan Hefner

import-window

v1.0.2

Published

Dynamic Window Manager for Electron

Readme

import-window

Simple BrowserWindow manager for Electron

Installing

NPM

npm install import-window

Using

Backend (main)

This is an example of creating a window in the backend, of course you need to import everything, and have the app events triggering it but here a basic overview

//Import all modules needed (Electron, path, url, import-window, etc)
const importwin = require('import-window')
let mainWin; //Create a global varaible to store a import window in

//Create a new window, all properties stem from BrowserWindow. This should trigger in the app.active event
mainWin = importwin.createWindow({
    show: false,
    backgroundColor: '#420024',
    frame: false,
    resizable: true,
    maximizable: true,
    backgroundColor: 'gray',
    webPreferences: {
      zoomFactor: 0.9,
    }
  })
/**** ImportWindow Methods ****/
  /**
* .setURL (directory, file, arguments)
* directory - location of file
* file - file
* arguments - a list of arugments to pass to render
* {name: "Fred", type: "2"} NEVER USE 'id' as an argument, its used by default for window numbering
* 
*/
mainWin.setURL(__dirname, "explorer.html", {name: "Hello"})

//Use .win to access any BrowserWindow functions
mainWin.win.setFullScreenable(false)
mainWin.win.setResizable(false)
mainWin.win.setMinimumSize(800, 600);
mainWin.win.setMaximumSize(800, 600);
//Easier way to ope dev tools
  
mainWin.openDevTools();
  
//Events via the BrowserWindow
mainWin.win.once('ready-to-show', () => {
  mainWin.win.show()
})
  
//Sets the location of loading files to main directory
importwin.setDir(__dirname) //Import for opening windows in the Electron Render

Frontend (arguments)

This will return arguments passed via the file (its based on get parameters, so there is a limit in theory)

const managerLocal = require("import-window")
let args
if (managerLocal.hasArgs() {
  args = managerLocal.parseArgs()
  //args.name = Fred
  //args.type = 2
}

Frontend (remote)

This how to create a new window in the RENDER PROCESS. Only change from normal backend is .getDir() instead of __dirname

const managerRemote = remote.require("import-window")
let mainWin = managerRemote.createWindow({
  show: false,
  width: 1000,
  height: 800,
  frame: false,
  color: "#000",
  webPreferences: {
    zoomFactor: 0.9,
  },
icon: path.join(managerRemote.getDir(), 'assets/icons/png/1024x1024.png')
})
//Intead of __dirname we used '.getDir()' 
mainWin.setURL(managerRemote.getDir(), "project.html", {
  serverIP: ip,
  sessionKey: sessionKey
})
mainWin.win.setMinimumSize(800, 700);
  mainWin.win.webContents.on('did-finish-load', () => {
  mainWin.win.show()
win.close();
})