Package Exports
- proxy-debounce-with-accumulator
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 (proxy-debounce-with-accumulator) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Proxy debounce with accumulator
This is a simple package implementing debounce with JS Proxy.
However, there is a big twist:
import debounce from "proxy-debounce-with-accumulator"
const f = debounce((n) => n), 100)
for (let i = 0; i < 10; i++) {
f(i)
}
such a code would call the f function once, as expected of a debounced function, but during this call the value of n would equal [0,1,2,3,4,5,6,7,8,9], since the call arguments are accumulated.
You can also await such a function:
import debounce from "proxy-debounce-with-accumulator"
const f = debounce((n) => n), 100)
for (let i = 0; i < 10; i++) {
if (i === 4) {
await f(i)
}
else {
f(i)
}
}
In such a code the arguments passed to the function would be: [0,1,2,3,4] and [5,6,7,8,9].
Performance
Run tests in order to see detailed performance differences between this package, lodash and regular objects.