vlocode-project - v1.40.0-beta-4
    Preparing search index...

    Function singleton

    • Simple function that registers any instance of a class as single and creates it when it is not existing. Instances are stored as globals which is the closest we can get to a real singleton. *

      Type Parameters

      • T extends new (...args: any) => InstanceType<T>

      Parameters

      • type: T

        The constructor type to create/get singleton for

      • ...args: ConstructorParameters<T>

        Optional constructor arguments that will be passed to the constructor when creating the instance

      Returns InstanceType<T>