vissense / vissense-configurable-polling-strategy

A configurable polling strategy for VisSense.js

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Build Status Coverage Status Dependency Status devDependency Status

VisSense.js: Configurable Polling Strategy

A configurable polling strategy for VisSense.js.

This plugin aims to provide a more advanced polling strategy than the base library.

It has an external dependency to Again.js.

Examples

Update a monitor on provided intervals depending on the current state.

var element = document.getElementById('myElement');

var monitor = VisSense(element).monitor({
  strategy: new VisSense.VisMon.Strategy.ConfigurablePollingStrategy({
    hidden: 9001, // over 9000!
    visible: 1042, // 1000ms + the meaning of life
    fullyvisible: 666 // number of the beast
  }),
  update: function (monitor) {
    observer.callback(monitor);
  }
}).start();

This monitor will be updated every 9 seconds when the element is hidden, every second when it is visible and every ~700 milliseconds when it is fullyvisible.

Contribute

License

The project is licensed under the MIT license. See LICENSE for details.

About

A configurable polling strategy for VisSense.js

License:MIT License


Languages

Language:JavaScript 90.9%Language:HTML 8.0%Language:Handlebars 1.2%