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

chrome-extension-reload-trigger

v1.0.6

Published

Reloading a window or tab triggers the reloading of your google chrome extension

Readme

Chrome Extension Reload Trigger

Getting straight to the point, what this thing does is to reload your chrome extension once you reload a target window or tab.

Sometimes, manually refreshing your chrome extension in the chrome extensions page chrome://extensions every after change is a really tiring task... So automation is a must!!!

There are existing solutions for this problem, but they are very hassle to implement and actually somehow their solution is weird and beats the purpose. Why would you create a bookmark and click that bookmark everytime there is a change??? or why would you open an another tab just to refresh the extension???

So why don't we just tell the extension to reload itself if the target window is about to reload? Isn't it a little easier and doesn't require much interaction than the other solutions?

Purpose

If you are developing a chrome extension and everytime you have a change in your code, you don't need to go into the extensions page and manually reload the extension in order for your changes to reflect.

You just need to refresh the target window and your extension will be able to detect it and automatically reloads and refreshes the content your extension.

Install via NPM

npm install chrome-extension-reload-trigger

How to use

Reload the extension when any window is reloaded:

    var XReloadTrigger = require('chrome-extension-reload-trigger');

    // if no rules are added before the init call, reloading of extension will trigger if any window is refreshed.

    // start
    XReloadTrigger.init();

or if you want to specify which window/windows:

    var XReloadTrigger = require('chrome-extension-reload-trigger');

    // match url 
    XReloadTrigger.matchUrl('http://google.com');

    // match url using regex
    XReloadTrigger.matchUrlPattern(/https?:\/\/google\.com.*/);

    // using a callback function
    // You can check the documention for the list of properties in a Tab object
    // https://developer.chrome.com/extensions/tabs#type-Tab
    XReloadTrigger.matchCustom(function(tab) {

        if (tab.url == 'http://google.com') {
            return true;
        } else {
            return false;
        }

    });

    // start
    XReloadTrigger.init();

NOTE : This code must be put inside your background script in order to work!

Webpack

By default, the module detects if the NODE_ENV variable exists and it will only execute if the environment is development. So if you compiled using the production flag, the reloading of the extension will not trigger when the target window refreshes, because the module will only work if the value of the environment variable is development.

But if you want the module to work even when your application is compiled for production, you can disable the check by adding this call into your code before firing the init function.


    XReloadTrigger.disableNodeEnvCheck(true);

or in a full example:

    var XReloadTrigger = require('chrome-extension-reload-trigger');

    XReloadTrigger.disableNodeEnvCheck(true);

    // start
    XReloadTrigger.init();

Standalone

If you are not using node and a module bundler like webpack, you can directly include the chrome-extension-reload-trigger.js into your page. Lodash is required so you need to include it as well before the module script.

    <script src="//cdn.jsdelivr.net/npm/[email protected]/lodash.min.js"></script>
    <script src="chrome-extension-reload-trigger/chrome-extension-reload-trigger.js"></script>

    <script type="text/javascript">
    
        // match url 
        XReloadTrigger.matchUrl('http://google.com');

        // match url using regex
        XReloadTrigger.matchUrlPattern(/https?:\/\/google\.com.*/);

        // using a callback function
        // You can check the documention for the list of properties in a Tab object
        // https://developer.chrome.com/extensions/tabs#type-Tab
        XReloadTrigger.matchCustom(function(tab) {

            if (tab.url == 'http://google.com') {
                return true;
            } else {
                return false;
            }

        });

        // start
        XReloadTrigger.init();
    
    </script>

Support and Contribution

If you are experiencing problems while using this module, you can create an issue here.

If you want to contribute, you are free to send as a pull request anytime!