ts-debounce-throttle
Typescript Version of debounce and throttle
- fully migrate from lodash v4.17.5 - debounce & throttle
- rewritten with Typescript
- fully tested
为了仅仅使用 lodash 中的 debounce
和 throttle
这两个函数的 TS 版本,在社区库库找了半天没有找到,于是只能自己动手将其迁移成 Typescript 版本;
这两个函数的功能完全对齐 lodash 中的 debounce
和 throttle
中的功能,也就是说其 API 和 lodash 中保持一致,可以直接参考官方文档的使用:
迁移的时候,使用的是 lodash v 4.17.5 版本源码,不过考虑到这两个函数已经很稳定,所以 lodash 的版本升级对这个两个函数的影响很有限;
Installation
Node.js / Browserify
npm install ts-debounce-throttle --save
const debounce throttle = ; // Avoid costly calculations while the window size is in flux.; // Avoid excessively updating the position while scrolling.;
Global object
Include the pre-built script.
Build & test
npm run build
npm test
License
MIT.