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.
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
.
- Issue Tracker: https://github.com/vissense/vissense-configurable-polling-strategy/issues
- Source Code: https://github.com/vissense/vissense-configurable-polling-strategy
The project is licensed under the MIT license. See LICENSE for details.