wm
web-monitoring
npm i web-monitoring
wm

web-monitoring

Simple web monitoring in node js

by Antonio Musolino

3.2.2 (see all)License:ISCTypeScript:Not Found
npm i web-monitoring
Readme

web-monitoring NPM Version node

Standard - JavaScript Style Guide

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

web-monitoring-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

License

This project is licensed under the MIT License - see the LICENSE file for details

Downloads/wk

72

GitHub Stars

24

LAST COMMIT

3mos ago

MAINTAINERS

1

CONTRIBUTORS

4

OPEN ISSUES

1

OPEN PRs

12
VersionTagPublished
3.2.2
latest
3mos ago
No alternatives found
No tutorials found
Add a tutorial