|
| 1 | +// Generated by dts-bundle v0.7.3 |
| 2 | + |
| 3 | +declare module 'memd' { |
| 4 | + import { deco_memoize } from 'memd/deco/memoize'; |
| 5 | + import { deco_debounce } from 'memd/deco/debounce'; |
| 6 | + import { deco_throttle } from 'memd/deco/throttle'; |
| 7 | + import { deco_queued } from 'memd/deco/queued'; |
| 8 | + import { fn_memoize } from 'memd/fn/memoize'; |
| 9 | + import { Cache } from 'memd/Cache'; |
| 10 | + class Memd { |
| 11 | + static Cache: typeof Cache; |
| 12 | + static fn: { |
| 13 | + memoize: typeof fn_memoize; |
| 14 | + }; |
| 15 | + static deco: { |
| 16 | + memoize: typeof deco_memoize; |
| 17 | + throttle: typeof deco_throttle; |
| 18 | + debounce: typeof deco_debounce; |
| 19 | + queued: typeof deco_queued; |
| 20 | + }; |
| 21 | + static default: typeof Memd; |
| 22 | + } |
| 23 | + export = Memd; |
| 24 | +} |
| 25 | + |
| 26 | +declare module 'memd/deco/memoize' { |
| 27 | + import { ICacheOpts } from 'memd/Cache'; |
| 28 | + export function deco_memoize(opts?: ICacheOpts): (target: any, propertyKey: any, descriptor?: any) => any; |
| 29 | +} |
| 30 | + |
| 31 | +declare module 'memd/deco/debounce' { |
| 32 | + /** |
| 33 | + * |
| 34 | + * @param timeout ms to wait before calling inner fn |
| 35 | + */ |
| 36 | + export function deco_debounce(timeout?: number): (target: any, propertyKey: any, descriptor?: any) => any; |
| 37 | +} |
| 38 | + |
| 39 | +declare module 'memd/deco/throttle' { |
| 40 | + /** |
| 41 | + * Calls function maximal each time window frame |
| 42 | + * @param timeWindow how often, in ms, should the function be called |
| 43 | + * @param shouldCallLater start calling fn on frame start |
| 44 | + */ |
| 45 | + export function deco_throttle(timeWindow: number, shouldCallLater?: boolean): (target: any, propertyKey: any, descriptor?: any) => any; |
| 46 | +} |
| 47 | + |
| 48 | +declare module 'memd/deco/queued' { |
| 49 | + export function deco_queued(opts?: { |
| 50 | + trimQueue: boolean; |
| 51 | + }): (target: any, propertyKey: any, descriptor?: any) => any; |
| 52 | +} |
| 53 | + |
| 54 | +declare module 'memd/fn/memoize' { |
| 55 | + import { IMemoizeWrapper } from 'memd/model/IMemoizeWrapper'; |
| 56 | + import { ICacheOpts } from 'memd/Cache'; |
| 57 | + export function fn_memoize<T extends Function>(fn: T, opts?: ICacheOpts): IMemoizeWrapper<T>; |
| 58 | +} |
| 59 | + |
| 60 | +declare module 'memd/Cache' { |
| 61 | + export interface ICacheOpts { |
| 62 | + maxAge?: number; |
| 63 | + monitors?: ICacheChangeEventMonitor[]; |
| 64 | + keyResolver?: (...args: any[]) => string; |
| 65 | + } |
| 66 | + export interface ICacheChangeEventMonitor { |
| 67 | + on(event: 'change', fn: Function): any; |
| 68 | + off(event: 'change', fn: Function): any; |
| 69 | + } |
| 70 | + export interface ICacheEntry<T = any> { |
| 71 | + timestamp: number; |
| 72 | + value: T; |
| 73 | + } |
| 74 | + export class Cache<T = any> { |
| 75 | + options: ICacheOpts; |
| 76 | + constructor(options?: ICacheOpts); |
| 77 | + resolveKey(...args: any[]): string; |
| 78 | + get(key: string): T; |
| 79 | + set(key: string, val: T): T; |
| 80 | + clear(key?: string): void; |
| 81 | + destroy(): void; |
| 82 | + } |
| 83 | +} |
| 84 | + |
| 85 | +declare module 'memd/model/IMemoizeWrapper' { |
| 86 | + export interface IMemoizeWrapper<T extends Function> { |
| 87 | + (fn: T): T; |
| 88 | + clearArgs(...args: any[]): any; |
| 89 | + clearAll(): any; |
| 90 | + } |
| 91 | +} |
| 92 | + |
0 commit comments