Options
All
  • Public
  • Public/Protected
  • All
Menu

Type parameters

  • CT

Hierarchy

  • default

Index

Constructors

constructor

  • Type parameters

    • CT

    Returns default<CT>

Properties

components

components: Map<string, CT> = ...

Accessors

componentTypes

  • get componentTypes(): string[]
  • Get the component type names that are currently being used in the collection.

    Returns string[]

size

  • get size(): number

Methods

add

  • add(component: CT): void

get

  • get<T>(cl: ClassConstructor<T>): T
  • Get a component that matches the passed class. Will throw an error if an instance of the given component doesn't exist in the collection, so if you don't know if it's safe to get a component, you should test with has() or hasByName() first. You have been warned.

    Type parameters

    • T

    Parameters

    • cl: ClassConstructor<T>

      component Class reference.

    Returns T

has

  • has(cType: ClassConstructor<CT> | ClassConstructor<CT>[]): boolean
  • Test to see if the collection contains a specific Class or Classes.

    Parameters

    • cType: ClassConstructor<CT> | ClassConstructor<CT>[]

      component Class, or array of component Classes.

    Returns boolean

hasByName

  • hasByName(cName: string | string[]): boolean
  • Test to see if the collection has a component instance based on a class name. Some build steps/minifiers will change the name of Classes, so it's usually best to pass in a MyClass.name instead of 'MyClass'.

    Parameters

    • cName: string | string[]

      The name of a Class, or array of Class names.

    Returns boolean

remove

  • remove(cType: ClassConstructor<CT>): void
  • Remove a component.

    Parameters

    • cType: ClassConstructor<CT>

      Class of component to remove.

    Returns void

toDevComponents

  • toDevComponents(): Record<string, CT>

update

  • update<T>(cl: ClassConstructor<T>, func: (c: T) => T): void
  • Type parameters

    • T

    Parameters

    • cl: ClassConstructor<T>
    • func: (c: T) => T
        • (c: T): T
        • Parameters

          • c: T

          Returns T

    Returns void

Generated using TypeDoc