Options
All
  • Public
  • Public/Protected
  • All
Menu

Namespace Injector

Callable

  • Injector<T>(constructor: Class<T>): {}
  • Classes decorated with Injector will have their methods automatically injected using inject.

    These injections will not be automatically cleaned up. To prevent a memory leak, make sure you always call Injector.deregister on the instance when you're done with it.

    Note: Alternatively, if you want to register your injection instances manually on a case-by-case basis, you can instead use Injector.register

    Type parameters

    • T

    Parameters

    Returns {}

Index

Functions

Functions

deregister

  • deregister<T>(injectorClass: Class<T>, instance: T): boolean
  • Removes the injections (@Inject-decorated methods) of this class.

    Note: Due to the implementation, this operation is negligible, so don't worry about performance impacts of calling it.

    Type parameters

    • T

    Parameters

    • injectorClass: Class<T>
    • instance: T

    Returns boolean

register

  • register<T>(injectorClass: Class<T>, instance: T): void
  • Injects the @Inject-decorated methods of this class into their respective classes.

    These injections will not be automatically cleaned up. To prevent a memory leak, make sure you always call Injector.deregister on the instance when you're done with it.

    Note: Due to the implementation, this operation is negligible, so don't worry about performance impacts of calling it.

    Note: If you want your instance's injections to be registered automatically, decorate the class with @Injector

    Type parameters

    • T

    Parameters

    • injectorClass: Class<T>
    • instance: T

    Returns void

Generated using TypeDoc