Package Exports
- ts-debounce
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (ts-debounce) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
TypeScript implementation of debounce function 
Debounce create a new function g, which when called will delay the invocation of the original function f until n milliseconds after it was last called.
It's very useful for scenarios where it's better to limit the number of times the function is called. E.g. think of search input which fetches data from API. It's enough display search results after user stopped entering characters for some time.
Function arguments
import { debounce } from 'ts-debounce';
const debouncedFunction = debounce(originalFunction, waitMilliseconds, options);originalFunction- the function which we want to debounce
waitMilliseconds- how many seconds must pass after most recent function call, for the original function to be called
options- options object supports now one argument
isImmediate- if set to
truethenoriginalFunctionwill be called immediately, but on subsequent calls of the debounced function original function won't be called, unlesswaitMillisecondspassed after last call
- if set to
Credits & inspiration
This implementation is based upon following sources:
- JavaScript Debounce Function by David Walsh
- Lodash implementation
Contributors
Karol Majewski 💻 |
Fabien Rogeret 💻 |
|---|
- Project tries to adhere to all-contributors specification