1.0.0 • Published 3 years ago

chrome-reloader v1.0.0

Weekly downloads
2
License
ISC
Repository
-
Last release
3 years ago

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