debounce-stream
Debounces a stream.
Example
var events = require('dom-delegation-stream')
, values = require('dom-value-object-stream')
, debounce = require('debounce-stream')
events(document.querySelector('[rel=inputs]'), 'input')
.pipe(values())
.pipe(debounce(500))
.on('data', function(data) {
console.log(data)
})
API
debounce([milliseconds] [, immediate])
- Create a new debounce duplex stream
milliseconds
- Integer. The number of milliseconds to debounce the
stream. Defaults to 100
immediate
- Boolean. If true
, the debounced function will call
immediately, rather than at the end of input. Default is false
.
Returns a duplex stream that accepts values on one end, and emits the debounced
values on the other.
Notes
This module which was previously known as stream-debounce
is now known as
debounce-stream
. Thanks to RangerMauve for allowing this
module to take over that name! The version was bumped to v2.0.0 for the name
change, and to ensure compatibility for users of the old version.
License
MIT. See LICENSE for details.