UNPKG

nope-js-browser

Version:

NoPE Runtime for the Browser. For nodejs please use nope-js-node

21 lines (20 loc) 832 B
/** * @author Martin Karkowski * @email m.karkowski@zema.de * @desc [description] */ /** * Function to get a singleton. To create the singleton, the parameter *create* is used. This will be called once. * The singleton will be stored as *global* variable and can be accessed by the identifier * * @author M.Karkowski * @export * @template T The Type of the singleton * @param {string} identifier Identifier to access the singleton * @param {() => T} create The Callback which is used to create the instance. * @return An object, containing the key **instances**, where you'll find the instance and an helper function **setInstance** to redefine the instance */ export declare function getSingleton<T>(identifier: string, create: () => T): { instance: T; setInstance: (value: T) => void; };