1.1.1 • Published 1 month ago

ws-reload-plugin v1.1.1

Weekly downloads
-
License
ISC
Repository
github
Last release
1 month ago
wsReloadPlugin 中文
Upate: Fix the bug that the new version of the chrome kernel does not refresh

a webpack auto reload plugin for chrome extension v3 developers

The run steps:
  • 1.create a websocket server and client in node,when everytime compiler is finished,send message to content client(why not service worker? it will sleep, it needs event driven)
  • 2.create a websocket client in content to receive message, then send command to service worker
  • 3.service worker listen the command to reload runtime and tab

in your webpack.config.js, add the following code

// the parameter:  { port = 7777 }
const { wsAutoReloadPlugin } = require('ws-reload-plugin')
plugins: [new wsAutoReloadPlugin()]

in your content.js(content_scripts), add the following code

// the parameter: {reconnectTime = 20, port = 7777, message = 'compiler'}
// the interval of each reconnect is 3 seconds, it will reconnect 20 times by default
const { createWsConnect } = require('ws-reload-plugin')
createWsConnect({})
// or use ES module
import { createWsConnect } from 'ws-reload-plugin'
createWsConnect({})

in your background.js(service_worker), add the following code

// the parameters and default values::  bgdListenMsg(yourMsg = 'compiler')
// yourMsg must be as same as parameters.message in createWsConnect({})
const { bgdListenMsg } = require('ws-reload-plugin')
bgdListenMsg()
// or use ES module
import { bgdListenMsg } from 'ws-reload-plugin'
bgdListenMsg()
my complete vue3-based cli for extension develop
here are all history versions npmjs
1.1.1

1 month ago

1.1.0

10 months ago

1.0.9

1 year ago

1.0.8

1 year ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago