web-monitoring
v3.2.2
Published
Simple web monitoring in nodejs
Downloads
28
Readme
web-monitoring
Web-monitoring is a small web page monitoring lib written in node.js, you can monitor changing of a web page. Compatible with Node v14.0.0 and above.
App
How to install
npm install web-monitoring --save
How To Use
var options =
{
whileControl: Function, // function called when lapse expired. if returns true, the event 'alert' will be call.
lapse: Number, // lapse time in ms.
percentageDiff: Number, // percentage difference that is needed to call 'alert' event. This option does not need if whileControl function is set.
got: Object // Got options
}
Example:
var wm = require('web-monitoring')
var options =
{
whileControl: (oldPage,newPage) => oldPage === newPage,
lapse: 5000
}
var wp = wm.monitor('http://www.google.com', options)
.start()
.on('start', (url) => console.log(`monitoring of '${url}' start`))
.on('alert', (url,page) => {
console.log('page changed')
wp.stop()
})
.on('check', (oldPage, newPage) => {
})
.on('error', (err) => console.log(error))
Example:
var wm = require('web-monitoring')
var options =
{
lapse: 5000,
percentageDiff: 0.1,
}
var wp = wm.monitor('http://www.google.com', options)
.start()
.on('start', (url) => console.log(`monitoring of '${url}' start`))
.on('alert', (url,page) => {
console.log('page changed')
wp.stop()
})
.on('check', (oldPage, newPage) => {
})
.on('error', (err) => console.log(error))
Allert will be called when oldPage is different from newPage of 0.1.
Authors
- Antonio Musolino - antoniomuso
License
This project is licensed under the MIT License - see the LICENSE file for details