Skip to content
Just focus on your code, no need to press reload button šŸ˜
JavaScript HTML
Branch: master
Clone or download
TheMisir Merge pull request #1 from imam/patch-1
Simple typo fix. DONE
Latest commit 2526446 Jan 14, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore šŸŒŸ First commit Nov 25, 2018
README.md Simple typo fix Dec 4, 2018
package-lock.json šŸŒŸ First commit Nov 25, 2018
package.json ā« Package version changed Nov 25, 2018
test.html šŸŒŸ First commit Nov 25, 2018
watchist-cli.js šŸ˜… Fixed current working directory issue Nov 25, 2018
watchist.js šŸŒŸ First commit Nov 25, 2018
watchist.min.js šŸŒŸ First commit Nov 25, 2018

README.md

Watchist

npm version

Reload browser automatically when file system is changed. Why it's required? Because, reloading browser is really annoying thing.

How works?

Watchist looks for file system changes using chokidar package. And uses long polling technique to detect file system is changed or not.

Installation

Install package using npm.

$ npm install -g watchist

Documentation

It's very very easy to configure and use watchist on your PC, Mac and Linux.

1. Add the script to end of your html file

Add watchist.min.js to end of your html file to enable auto refresh.

<script src="https://cdn.jsdelivr.net/npm/watchist/watchist.min.js"></script>

If you want to use it with customized parameters then add your parameters to window.Watchist object like that.

<script>
window.Watchist = {
    // Custom host (with port number)
    host   : 'http://localhost:2588',
    // Custom reload function
    reload : () => location.reload()
};
</script>
<script src="https://cdn.jsdelivr.net/npm/watchist/watchist.min.js"></script>

2. Start watchist cli

Open your terminal (or command promt in windows) and type this code:

$ watchist

You can customize watchist by adding some parameters.

Parameter Alternative Example Description
--port= -p= --port=8080 Defines custom server port (default: 2588)
--debug -d --debug Enables debug mode

Warning: You must change host (window.Watchist.host = 'http://localhost:<PORT>') in your client script if you have changed the port number

# Set port number to 8080 and enable debug mode
$ watchlist --port=8080 --debug
# or using alternative arguments
$ watchlist -p=8080 -d

Note: You can also use watch comment instead of watchist.

You canā€™t perform that action at this time.