1.1.0 • Published 5 years ago

ontime-di v1.1.0

Weekly downloads
60
License
MIT
Repository
github
Last release
5 years ago

The library is used to dependency injection.

import { Injectable, Inject, Container } from 'ontime-di';

@Injectable
class Test1 {

}

@Injectable
class Test2 {
  constructor(@Inject(Test) private _test1: Test1) {}

  getTest1(): Test1 {
    return this._test1;
  }
}

const t2 = Container.get<Test2>(Test2);

(t2 instanceof Test2) // -> true
(t2.getTest1() instanceof Test1) // -> true