webpage-watch

5.3.0 • Public • Published

webpage-watch

Triggers a function when a change is deteched (custom defined change) on a webpage.

Install

    npm install webpage-watch

Usage

  var watchUrl = require('webpage-watch');
  watchUrl({requestOpts: requestOpts, frequency: WATCH_FREQUENCY, extractInfo: extractInfo, callback: intimate});

The function takes the following arguments:

  • requestOpts (Object): Request options to fetch the URL. Uses same options as request npm module.
  • frequency (Integer): An Integer representing how often (in ms) the URL needs to be checked. Optional - Defaults to 10000ms.
  • times (Integer): An Integer representing how many times to query the URL. -1 forever. Optional - Defaults to -1.
  • extractInfo (function) : A function to parse the body from the reponse and returns a string which will be compared every call to check for changes. Optional - Defaults to entire response body
  • callback (function) : A function that will be called when a change is indentified in the extracted info in consecutive requests. Optional - Defaults to printing the change to the console.
  • afterAll (function) : A function that is called after the watch is completed (error is observed or number of times to execute is completed) Optional

Todos

  • Write MOAR Tests

License

ISC

Free Software

Package Sidebar

Install

npm i webpage-watch

Weekly Downloads

0

Version

5.3.0

License

ISC

Last publish

Collaborators

  • havah