Options
All
  • Public
  • Public/Protected
  • All
Menu

Converge.js

Index

Type Aliases

AnyConstructable: (abstract new (...args: unknown[]) => unknown)

Type declaration

    • abstract new (...args: unknown[]): unknown
    • Any constructable type (i.e., any class type).

      Parameters

      • Rest ...args: unknown[]

      Returns unknown

Constructor<T, TParams>: {}

A paramaterized constructable type (i.e., any class type).

remarks

Where T represents an abstract class you will be required to explicitly specify the constructor parameters. This is because TypeScript cannot infer any parameters that will be specified in any derived type. If you simply want a constructor type that represents anything derived from the abstract class and accepts any constructor parameters, then use:

type AbstractBaseConstructor = Constructor<typeof Base, [...unknown[]]>;

You can also define a type of constructor where the instances are to implement a given interface, by combining Constructor with Implementing, as follows:

type FooConstructor = Constructor<Implementing<IFoo>>;

You may also constrain the constructor parameters by explicitly specifying them. For example, the following defines FooConstructor to be a constructor accepting a number and a string parameter, and returning an object that implements IFoo.

type FooConstructor = Constructor<Implementing<IFoo>, [a: number, b: string]>;

Type Parameters

  • T extends AnyConstructable = any

    The type being constructed.

  • TParams extends [...unknown[]] = ConstructorParameters<T>

    The constructor parameters that are required to create an instance of T. Defaults to the constructor parameters of T.

Type declaration

    DiposeTypedEventCallback: (() => void)

    Type declaration

      • (): void
      • A function that when invoked, will remove the associated listener from a TypedEvent.

        Returns void

    Implementing<TImpl>: (new (...args: unknown[]) => TImpl)

    Type Parameters

    • TImpl

    Type declaration

      • new (...args: unknown[]): TImpl
      • A constructable type that provides a given implementation.

        Parameters

        • Rest ...args: unknown[]

        Returns TImpl

    TypedEventListener<T>: ((event: T) => void)

    Type Parameters

    • T

    Type declaration

      • (event: T): void
      • A listener of a TypedEvent.

        Parameters

        • event: T

        Returns void

    Variables

    WorkerEnvSymbol: { isWorker: string }

    Defines symbols for working with worker environment data.

    Type declaration

    • isWorker: string

      A property that represents a flag indicating whether the current thread should be marked as a worker.

    platformFlags: RuntimeFlags

    A constant that describes the current set of RuntimeFlags that define the current platform.

    runtimeFlags: RuntimeFlags

    A constant that describes the cumulative set of all current RuntimeFlags.

    Functions

    • isMainThread(): boolean
    • Returns an indicator as to whether the caller is running on the main thread.

      Returns boolean

      true if the RuntimeFlags.worker flag is not set on the current runtimeFlags; otherwise false.

    • isWorkerThread(): boolean
    • Returns an indicator as to whether the caller is running on a worker thread.

      Returns boolean

      true if the RuntimeFlags.worker flag is set on the current runtimeFlags; otherwise false.

    • targetDisplayName(target: Constructor<any, unknown[]>): string
    • Retrieves the display name of a constructable type.

      Parameters

      Returns string

      The name of target, or some default if a name could not be found.

    Generated using TypeDoc