throttle-observ
v1.1.0
Published
Throttles observ object broadcast to specified rate.
Downloads
3
Maintainers
Readme
throttle-observ
Throttles observ object broadcast to specified rate.
Example
var Observ = require('observ')
var source = Observ()
setInterval(function () {
// set every 10 ms
source.value.set(Date.now())
}, 10)
var minDelayMs = 100
// create sub observable
var ThrottleObserv = require('throttle-observ')
var throttled = ThrottleObserv(source, minDelayMs)
throttled(function (value) {
// only broadcast every 100 ms
console.log(value)
})
// or watch
var throttledWatch = require('throttle-observ/watch')
var release = throttledWatch(source, minDelayMs, function (value) {
// only broadcast every 100 ms
console.log(value)
})