Skip to content

fab1o/ioc

Repository files navigation

@fab1o/ioc

IoC container for TypeScript.

Usage

import { Container } from '@fab1o/ioc';

const container = new Container();

interface Ball {}
class Volleyball implements Ball {}

container.register<Ball>('ball', Volleyball);

const ball = container.get<Ball>('ball');
const ball2 = container.get<Ball>('ball');

ball === ball2; // false

Singleton

interface Ball {}
class Volleyball implements Ball {}

container.register<Ball>('ball', Volleyball, { singleton: true });

const ball = container.get<Ball>('ball');
const ball2 = container.get<Ball>('ball');

ball === ball2; // true

About

IoC container for TypeScript/JavaScript

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published