chrome-reloader

1.0.0 • Public • Published

Install

npm i extension-reloader -g

Webextension

add this to your background.js

const connectReloader = () => {
    try {
        const ws = new WebSocket("ws://localhost:6699/");
        ws.onopen = () => {
            console.log(" |");
            console.log(" |>  connected to websocket");
        };
        ws.onmessage = (msg) => {
            if(msg.data === "reload") {
                console.log("reload");
                chrome.runtime.reload();
            }
        }
        ws.onclose = () => {
            setTimeout(connectReloader, 300);
        }
    } catch (e) {
        setTimeout(connectReloader, 300);
        return
    }

}

connectReloader();

Run in the root of the webextension (where the manifest.json is).

Or in the folder where you wanna watch

reloader

Dependencies (1)

Dev Dependencies (0)

    Package Sidebar

    Install

    npm i chrome-reloader

    Weekly Downloads

    1

    Version

    1.0.0

    License

    ISC

    Unpacked Size

    1.63 kB

    Total Files

    3

    Last publish

    Collaborators

    • zoutepopcorn