/**
 * This code creates a *true* singleton that will never be duplicated across webpack module loads.
 * If the singleton already exists then it is returned, otherwise a new one is created from the
 * provided constructor.
 *
 * Two situations that force the need for true singletons are preloads and storage adapters. In
 * both cases, code is being inserted (as a preload or a <script>) that contains the same modules
 * that a developer might otherwise *import* into their own code base. For instance, the preload
 * contains a router client, so if you also import a router client then you'll have two separately
 * webpacked router client modules running in parallel. The true singleton pattern ensures that
 * both of those modules are using the same underlying instance, otherwise one of the instances
 * will probably be non-operational.
 *
 * In general, avoid singletons (the module instance pattern) altogether. Instead, pass instances into
 * functions.
 *
 * // dangerous
 * import RouterClient from "./RouterClient";
 *
 * blah() {
 *    RouterClient.send("blah")
 * }
 *
 * // safe
 *
 * blah(routerClient : RouterClent){
 *    RouterClient.send("blah")
 * }
 *
 * // safe
 *
 * class Blah {
 *    static routerClient: RouterClient;
 *    constructor(routerClient : RouterClient){
 *        this.routerClient = routerClient;
 *    }
 *
 *    blah(){
 *       this.routerClient.send("blah")
 *    }
 * }
 *
 * Internals:
 *
 * `Symbol.for("blah")` is a safe equivalent to `window.blah =`.
 * It won't appear on the window object and it won't conflict with other applications.
 *
 * Recipe:
 * https://derickbailey.com/2016/03/09/creating-a-true-singleton-in-node-js-with-es6-symbols/
 *
 * Typescript for a constructor:
 * https://stackoverflow.com/questions/39392853/is-there-a-type-for-class-in-typescript-and-does-any-include-it
 *
 * @param {string} key A key that is unique within the application.
 * @param {object} Ctor A constructor class.
 *
 * @examnple
 * if(!MyClass.instance) MyClass.instance = singleton("MyClassKey", MyClass);
 */
export declare const singleton: <A>(key: string, Ctor: new () => A) => A;
//# sourceMappingURL=Singleton.d.ts.map