/** * Copyright © 2019 Cenacle Research India Private Limited. * All Rights Reserved. */ export type TTag = string; export type THelp = string; export interface ISingleton { p: Promise; help: THelp; } export type TPromiseGroup = Map>; export declare function getNewPromiseGroup(): TPromiseGroup; /** * Caches and returns the same promise on repeated calls. * The value resolved by the promise will be static and does not vary. * Use the `reset` method to reinitialize the promise. * * @template TResult * @param {() => Promise} fn - Function that creates the promise * @param {TTag} tag - Unique identifier for the singleton * @param {THelp} help - Descriptive help text, if any, for UI purposes * @param {TPromiseGroup} [promiseGroup=gPromises] - Group to store singletons * @returns {Promise} The singleton promise */ export declare function singletonPromise(fn: () => Promise, tag: TTag, help?: THelp, promiseGroup?: TPromiseGroup): Promise; /** * Resets the promises so that next time when they are called, they will * initialize all over again instead of returning cached values. Useful * to reload the data associated with the promises when the underlying * configuration parameters change. * @param {String | Array} tag the promises that need to be reset. */ export declare function reset(tag?: TTag | Array | null, promiseGroup?: TPromiseGroup): boolean | void | boolean[]; //# sourceMappingURL=singleton-promise.d.ts.map