open-index/open-npm huggingface dataset:
npm package: @null-studios/universal-ioc
Description: Simple TypeScript IoC container.
Author: nate-wilkins
Latest version: 2.0.0

# universal-ioc

> Simple TypeScript IoC container.

```
yarn add @null-studios/universal-ioc
```

## Usage

```
import { IocContainer } from '@null-studios/universal-ioc';

class Application {
  public static inject = [
    'configuration',
  ] as const;

  constructor(
    configuration: Configuration,
  ) {
    // ...
  }
}

const container = new IocContainer().register([
  {
    type: 'value',
    name: 'configuration',
    value: {
      width: 300,
      height: 300,
      frameRate: 120,
    },
  },
  {
    type: 'class',
    name: 'application',
    constructor: Application,
    lifetime: 'singleton',
  },
]);

const application = container.resolve('application') as Application;

application.start();
```