es6-promise-debounce
es6-promise-debounce copied to clipboard
TS typings
Usage: import debounce from 'es6-promise-debounce';
TypeScript typings definition if needed.
hi, can you please explain the "index.d.ts" !? I dont get it :)
It allows your package to be imported in a TypeScript project and adds static type definitions for it too. I used the default name index.d.ts
so your package.json
doesn't have to be modified but a TS project can still resolve it. Other projects like momentjs include a .d.ts
as well.
This is an optional PR and I can understand if you want to keep this project lightweight but I thought it would be a nice addition since it's just a small 2 lines to get it working 😄 . Thanks!
TS Usage:
import debounce from 'es6-promise-debounce';
var debouncedFunction = debounce(function() {
return new Promise(function(resolve) {
resolve();
});
}, 200);
debouncedFunction().then(function() { console.log('this one should be ignored'); });
debouncedFunction().then(function() { console.log('this one should be executed'); });