Implement `VariadicSingleton` and `VariadicMutableSingleton`
samchon opened this issue · 0 comments
samchon commented
Implement variadic singleton classes.
export class VariadicSingleton<T, Args extends any[]>
{
public constructor
(
closure: (...args: Args) => T),
hashFunc?: (args: Args) => number,
pred?: (x: Args, y: Args) => boolean
);
public get(...args: Args[]): T;
}
export class VariadicMutableSingleton<T, Args extends any[]>
{
public constructor
(
closure: (...args: Args) => Promise<T>,
hashFunc?: (args: Args) => number,
pred?: (x: Args, y: Args) => boolean
);
public set(...items: [...Args, T]): Promise<void>;
public reload(...args: Args): Promise<T>;
public get(...args: Args): Promise<T>;
public is_loaded(...args: Args): Promise<boolean>;
}