web-monitoring

3.2.2 • Public • Published

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

Readme

Keywords

none

Package Sidebar

Install

npm i web-monitoring

Weekly Downloads

9

Version

3.2.2

License

ISC

Unpacked Size

17 kB

Total Files

21

Last publish

Collaborators

  • antoniomuso