UNPKG

ts-ioc-container

Version:

Fast, lightweight TypeScript dependency injection container with a clean API, scoped lifecycles, decorators, tokens, hooks, lazy injection, customizable providers, and no global container objects.

17 lines (16 loc) 556 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.debounce = void 0; const debounce = (ms) => (target, propertyKey, descriptor) => { const originalMethod = descriptor.value; const timerMap = new WeakMap(); descriptor.value = function (...args) { const prev = timerMap.get(this); if (prev !== undefined) { clearTimeout(prev); } timerMap.set(this, setTimeout(() => originalMethod.apply(this, args), ms)); }; return descriptor; }; exports.debounce = debounce;