@botonic/plugin-contentful
Version:
## What Does This Plugin Do?
28 lines (27 loc) • 701 B
TypeScript
export declare class Singleton<T> {
private readonly factory;
private factoryOutput;
private isValueSet;
constructor(factory: () => T);
get value(): T;
}
/**
* Singletons dictionary accessible through a string
*/
export declare class SingletonMap<T> {
private readonly map;
constructor(map: {
[key: string]: () => T;
});
value(key: string): T;
}
/**
* Given a factory function (string) => T,
* it ensures that we don't invoke it more than once per each input value
*/
export declare class DynamicSingletonMap<T> {
private readonly factories;
private readonly values;
constructor(factories: (key: string) => T);
value(key: string): T;
}