@exadel/esl
Version:
Exadel Smart Library (ESL) is the lightweight custom elements library that provide a set of super-flexible components
46 lines (45 loc) • 2.03 kB
TypeScript
import type { MemoHashFn } from '../misc/memoize';
import type { MethodTypedDecorator } from '../misc/functions';
export declare function memoize(): MethodDecorator;
export declare function memoize<H extends MemoHashFn>(hashFn: H): MethodTypedDecorator<(...args: Parameters<H>) => any>;
export declare namespace memoize {
var clear: typeof clearMemo;
var has: typeof hasMemo;
}
/**
* Clear memoization cache for passed property of the target.
* Accepts not own properties.
* Note: be sure that you targeting memoized property or function.
* Clear utility has no 100% check to prevent modifying incorrect (not memoized) property keys
*
* @param target - object instance that holds property
* @param property - property, key of target, to clear cache
*/
declare function clearMemo<T extends object>(target: T, property: keyof T | (keyof T)[]): void;
/**
* Clear memoization cache for passed property of the target.
* Accepts not own properties.
* Note: be sure that you target memoized property or function.
* Clear utility has no 100% check to prevent modifying incorrect (not memoized) property keys
*
* @param target - object instance that holds property
* @param property - property, key of target, to clear cache
*/
declare function clearMemo(target: object, property: PropertyKey | PropertyKey[]): void;
/**
* Check if property has cache for the passed params
*
* @param target - object instance that holds property
* @param property - property, key of target, to check cache
* @param params - additional params of original memoized method
*/
declare function hasMemo<T extends object>(target: T, property: keyof T, ...params: any[]): boolean;
/**
* Check if property has cache for the passed params
*
* @param target - object instance that holds property
* @param property - property, key of target, to check cache
* @param params - additional params of original memoized method
*/
declare function hasMemo(target: object, property: PropertyKey, ...params: any[]): boolean;
export {};