https://github.com/victor141516/livereload
Golang liveReload for frontend development. Usage: ./liveReload [path] [port]
https://github.com/victor141516/livereload
Last synced: 2 months ago
JSON representation
Golang liveReload for frontend development. Usage: ./liveReload [path] [port]
- Host: GitHub
- URL: https://github.com/victor141516/livereload
- Owner: victor141516
- Created: 2018-06-20T13:10:54.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2018-06-29T11:00:04.000Z (almost 7 years ago)
- Last Synced: 2025-01-29T09:41:00.660Z (4 months ago)
- Language: Go
- Homepage:
- Size: 2.93 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# liveReload
Golang liveReload for frontend development. Usage: ./liveReload [path] [port]## Frontend code
```
// liveReload poller begin
const poller = setInterval(() => {
fetch('http://127.0.0.1:15555', {mode: 'cors'}).then(res => res.text().then(text => {
if (text === '1') {
location.reload();
}
})).catch(() => {
console.log('liveReload not detected, poller stopped.');clearInterval(poller); // eslint-disable-line
});
}, 1000);
// liveReload poller end
```