a zip code crypto-currency system good for red ONLY

debouncer.js 775B

12345678910111213141516171819202122232425262728
  1. var TimeoutDebouncer = (function () {
  2. function TimeoutDebouncer(wait) {
  3. this.wait = wait;
  4. this.timer = null;
  5. }
  6. TimeoutDebouncer.prototype.debounce = function (callback) {
  7. this.callback = callback;
  8. this.schedule();
  9. };
  10. TimeoutDebouncer.prototype.schedule = function () {
  11. this.cancel();
  12. if (this.wait <= 0) {
  13. this.callback();
  14. }
  15. else {
  16. this.timer = setTimeout(this.callback, this.wait);
  17. }
  18. };
  19. TimeoutDebouncer.prototype.cancel = function () {
  20. if (this.timer) {
  21. clearTimeout(this.timer);
  22. this.timer = null;
  23. }
  24. };
  25. return TimeoutDebouncer;
  26. }());
  27. export { TimeoutDebouncer };
  28. //# sourceMappingURL=debouncer.js.map