Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

Decorator.ts 619B

123456789101112131415161718192021
  1. import { Injector } from "./Injector";
  2. import { Type, GenericClassDecorator, Constructor } from "./Types";
  3. /**
  4. * @returns {GenericClassDecorator<Type<any>>}
  5. * @constructor
  6. */
  7. export function Singleton(_interface?: Constructor<any>): GenericClassDecorator<Type<any>> {
  8. return (clazz: Type<any>) => {
  9. Injector['modules'].push({
  10. implements: _interface ?? clazz,
  11. ctor: clazz
  12. })
  13. }
  14. }
  15. export function Inject(clazz: Constructor<any>) {
  16. return function (prototype: Object, key: string) {
  17. Injector['injectionQueue'].push({ injectionType: clazz, prototype: prototype, injectIntoKey: key })
  18. }
  19. }