1.1.4 • Published 7 years ago

pollr v1.1.4

Weekly downloads
2
License
ISC
Repository
github
Last release
7 years ago

pollr

A JavaScript/AJAX polling engine.

Usage

import Pollr from 'pollr';

var pollr = new Pollr({
  url: '/test',
  retries: 10,
  interval: 3000,
  responseType: 'json'
});

pollr.on('data', function(data) {
  if (data.foo === 'bar') {
    // Do something awesome
    pollr.stop(); 
  }
});

pollr.on('error', function(error) {
  console.error(error); // Called when response.statusCode != 200
});

pollr.start(); // Polls the server 11 times, unless stopped

Other Examples

Continuous polling

pollr.retries = null; 
pollr.start(); // Will poll until stopped

Post data

pollr.method = 'post';
pollr.data = { message: 'Is anybody home...?' };

Contact

AJ Bond

  • Email: olishmollie@gmail.com
  • Twitter: @olishmollie
1.1.4

7 years ago

1.1.3

7 years ago

1.1.2

7 years ago

1.1.1

7 years ago

1.1.0

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago