dependencyLookUp.js 841 B

12345678910111213141516171819202122232425
  1. import { getDependencyByIndex } from './decorators';
  2. import { LookUp } from './types';
  3. function changeLookup(target, index, lookUp) {
  4. var descriptor = getDependencyByIndex(target, index);
  5. descriptor.lookUp = lookUp;
  6. }
  7. function lookupDecoratorFactoryProducer(lookUp) {
  8. return function DecoratorFactory() {
  9. if (this instanceof DecoratorFactory) {
  10. return this;
  11. }
  12. return function (target, _key, index) {
  13. changeLookup(target, index, lookUp);
  14. };
  15. };
  16. }
  17. /**
  18. * when resolving this dependency, skip the current injector
  19. */
  20. export var SkipSelf = lookupDecoratorFactoryProducer(LookUp.SKIP_SELF);
  21. /**
  22. * when resolving this dependency, only search the current injector
  23. */
  24. export var Self = lookupDecoratorFactoryProducer(LookUp.SELF);
  25. //# sourceMappingURL=dependencyLookUp.js.map