function DiPlugin
Since 0.1.0
DiPlugin(options?: DiPluginOptions): IPlugin

Creates the DiPlugin.

The plugin registers an IContainer under CAPABILITIES.DI_CONTAINER at PLUGIN_PRIORITY.NORMAL. Other plugins can then access it via ctx.container (lazily resolved by the kernel) or ctx.services.get<IContainer>(CAPABILITIES.DI_CONTAINER).

Examples

Example 1

import { DiPlugin } from '@setu-ts/di-plugin';

app.register(DiPlugin({
  defaultScope: 'singleton',
  autoRegister: true,
}));

Parameters

optional
options: DiPluginOptions

Plugin configuration

Return Type

IPlugin

The plugin instance

Usage

import { DiPlugin } from "di-plugin/src/index.ts";