Type alias FactoryOptions<T>

FactoryOptions<T>: {
    onRemoved?: ((value: T) => void);
    scope?: "scoped" | "singleton";
} | {
    scope: "transient";
}

Options for factory binding.

scope types:

  • singleton - This is the default. The value is created and cached by the most distant parent container which owns the factory function.
  • scoped - The value is created and cached by the nearest container which owns the factory function.
  • transient - The value is created every time it is resolved.

scoped and singleton scopes can have onRemoved callback. It is called when a token is removed from the container.

Type Parameters

  • T

Generated using TypeDoc