Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

hexo-browser-reloader-websocket

Package Overview
Dependencies
Maintainers
0
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hexo-browser-reloader-websocket

A hexo plugin. Automatically reloads the browser when files are modified while the hexo-server is running.

  • 1.1.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
decreased by-66.67%
Maintainers
0
Weekly downloads
 
Created
Source

npm version CI | Coverage Report

hexo-browser-reloader-websocket

Automatically reloads the browser when files are modified while the hexo-server is running. Inspired by hexo-browsersync.

Usage

hexo-browser-reloader-websocket is transparent. Once installed, just run hexo-server.

[!WARNING] Please DO NOT USE in production (It means do not run hexo-server in production).

  • Please use this plugin only for development (local environment).
  • Hexo is a static site generator. It is not intended to run hexo-server in production.
  • This plugin does not encrypt between the WebSocket server and client.

Install

npm i hexo-browser-reloader-websocket

Configuration

Example (Defalut):

# _config.yml
browser_reloader_websocket:
  enable: true
  server:
    port: 4001
  notification:
    message: "reloadBrowser"
    wait:
      min: 150 # ms
      autoCalc:
        enable: true
        coefficient: 1.0
keytypedescriptiondefault
enablebooleanManage enable or disable this plugin.true
portnumberWebSocket server's port.4001
messagestringWebSocket message event data.reloadBrowser
wait.minnumberMinimum waiting time for reload browser after detecting file changes. Pleasse see About wait time.150
wait.autoCalc.enablebooleanCalculate the waiting time for the reload browser after detecting file changes based on the number of routes. Pleasse see About wait time.true
wait.autoCalc.coefficientnumberCoefficient for calculate wait time if autoCalc is enabled.1.0

About wait time

Reloading the browser by this plugin may be faster than the hexo-server's router updating if there are few routes or a lot of routes. The router updating speed depends on the number of post, pages, assets, tags, categories...etc. Also it depends on theme, plugins and machine power etc.

The wait option for resolve this, wait a little bit after file change detection before starting the browser reload.

About wait.autoCalc calculation formula

If the wait.autoCalc.enabled option is true, the plugin calculates the waiting time based on the number of routes. Below is a calculation formula.

// calculation formula
(<number of routes> / 10) * <autoCalc.coefficient> = wait(ms)

// example
(1200 / 10) * 0.9 = 108ms

Logger

Please see logger docs if you need.

Keywords

FAQs

Package last updated on 27 Jul 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc