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

chrome-extension-hot-reload

v0.2.2

Published

hot reloads chrome extension on development, affects popup tabs and options page

Downloads

248,176

Readme

Chrome Extension Hot Reload

This is an npm package that can be imported in background.js and popup.js files to make hot reloading possible in extensions.

Using this package, extensions' popups can be hot reloaded without having to close them!

Special Thanks to xpl since this package is initially based on his/her package crx-hotreload for timestamp retrieval and main ideas.

Install

Install it via npm install --save chrome-extension-hot-reload

Usage

In your background.js script add the following in top

import HotReload from 'chrome-extension-hot-reload';
HotReload.start();

In your popup.js script add the following in top

import HotReload from 'chrome-extension-hot-reload';
HotReload.connect();

You should NOT call connect in options page or content scripts, they should already work automatically if you have called start in background script.

Alternatively, (if you don't want to import both the start & connect scripts in both background and popup files you can import them separately as in below)

import start from 'chrome-extension-hot-reload/dist/start';
start();
import connect from 'chrome-extension-hot-reload/dist/connect';
connect();

Alternatively, if you prefer ES5, you can import the module as in below (all of them should work)

const HotReload = require("chrome-extension-hot-reload");
const start = require("chrome-extension-hot-reload/dist/start");
const connect = require("chrome-extension-hot-reload/dist/connect");

Configuration

In the connect method you can pass an options object to pass custom configurations.

import HotReload from 'chrome-extension-hot-reload';
HotReload.connect({
  // the milliseconds for which the script re-checks for file changes
  // by default, the script re-checks for every 1 second (1000 milliseconds)     
  retryTime: 1000,
  // whether to output popup connect logs (debug logs), by default it is false
  dbg: false
});

Features

  • Doesn't close popup / options page (doesn't force reloads the extension)
  • Using only in background.js is enough for hot reloading options page
  • Can also hot reload popups, using start/connect syntax (even if you do not have a background script, in order to get hot reloading in popups, you should create a background script file in which you call start)
  • Reloads tabs just as crx-hotreload.
  • Doesn't run if the extension is not in development mode just as crx-hotreload.