Import
This commit is contained in:
parent
276b202f6a
commit
e0a7d150e8
@ -1,4 +1,4 @@
|
||||
import { debounce, DebouncedFunc } from 'lodash';
|
||||
import debounce from 'lodash/debounce';
|
||||
|
||||
interface DebounceSettings {
|
||||
readonly leading?: boolean;
|
||||
@ -11,7 +11,8 @@ export function Debounce(milliseconds = 300, options?: DebounceSettings): Method
|
||||
const map = new WeakMap();
|
||||
const descriptorCopy = { ...descriptor };
|
||||
descriptorCopy.value = function _value(...args: unknown[]): void {
|
||||
let debounced: DebouncedFunc<any> = map.get(this) as DebouncedFunc<any>;
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
||||
let debounced = map.get(this);
|
||||
if (!debounced) {
|
||||
debounced = debounce(descriptor.value, milliseconds, options).bind(this);
|
||||
map.set(this, debounced);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user