injector.js 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577
  1. var __extends = (this && this.__extends) || (function () {
  2. var extendStatics = function (d, b) {
  3. extendStatics = Object.setPrototypeOf ||
  4. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  5. function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
  6. return extendStatics(d, b);
  7. };
  8. return function (d, b) {
  9. if (typeof b !== "function" && b !== null)
  10. throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
  11. extendStatics(d, b);
  12. function __() { this.constructor = d; }
  13. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  14. };
  15. })();
  16. var __assign = (this && this.__assign) || function () {
  17. __assign = Object.assign || function(t) {
  18. for (var s, i = 1, n = arguments.length; i < n; i++) {
  19. s = arguments[i];
  20. for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
  21. t[p] = s[p];
  22. }
  23. return t;
  24. };
  25. return __assign.apply(this, arguments);
  26. };
  27. var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
  28. if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
  29. if (ar || !(i in from)) {
  30. if (!ar) ar = Array.prototype.slice.call(from, 0, i);
  31. ar[i] = from[i];
  32. }
  33. }
  34. return to.concat(ar || Array.prototype.slice.call(from));
  35. };
  36. import { getDependencies } from './decorators';
  37. import { DependencyCollection, DependencyNotFoundError, DependencyNotFoundForModuleError, ResolvedDependencyCollection, clearResolvingStack, popupResolvingStack, pushResolvingStack, } from './dependencyCollection';
  38. import { normalizeFactoryDeps } from './dependencyDescriptor';
  39. import { normalizeForwardRef } from './dependencyForwardRef';
  40. import { isAsyncDependencyItem, isAsyncHook, isClassDependencyItem, isCtor, isFactoryDependencyItem, isValueDependencyItem, prettyPrintIdentifier, AsyncHookSymbol, isExistingDependencyItem, } from './dependencyItem';
  41. import { RediError } from './error';
  42. import { IdleValue } from './idleValue';
  43. import { LookUp, Quantity } from './types';
  44. var MAX_RESOLUTIONS_QUEUED = 300;
  45. var NotInstantiatedSymbol = Symbol('$$NOT_INSTANTIATED_SYMBOL');
  46. var CircularDependencyError = /** @class */ (function (_super) {
  47. __extends(CircularDependencyError, _super);
  48. function CircularDependencyError(id) {
  49. return _super.call(this, "Detecting cyclic dependency. The last identifier is \"".concat(prettyPrintIdentifier(id), "\".")) || this;
  50. }
  51. return CircularDependencyError;
  52. }(RediError));
  53. var InjectorAlreadyDisposedError = /** @class */ (function (_super) {
  54. __extends(InjectorAlreadyDisposedError, _super);
  55. function InjectorAlreadyDisposedError() {
  56. return _super.call(this, 'Injector cannot be accessed after it was disposed.') || this;
  57. }
  58. return InjectorAlreadyDisposedError;
  59. }(RediError));
  60. var AsyncItemReturnAsyncItemError = /** @class */ (function (_super) {
  61. __extends(AsyncItemReturnAsyncItemError, _super);
  62. function AsyncItemReturnAsyncItemError(id) {
  63. return _super.call(this, "Async item \"".concat(prettyPrintIdentifier(id), "\" returns another async item.")) || this;
  64. }
  65. return AsyncItemReturnAsyncItemError;
  66. }(RediError));
  67. var GetAsyncItemFromSyncApiError = /** @class */ (function (_super) {
  68. __extends(GetAsyncItemFromSyncApiError, _super);
  69. function GetAsyncItemFromSyncApiError(id) {
  70. return _super.call(this, "Cannot get async item \"".concat(prettyPrintIdentifier(id), "\" from sync api.")) || this;
  71. }
  72. return GetAsyncItemFromSyncApiError;
  73. }(RediError));
  74. var AddDependencyAfterResolutionError = /** @class */ (function (_super) {
  75. __extends(AddDependencyAfterResolutionError, _super);
  76. function AddDependencyAfterResolutionError(id) {
  77. return _super.call(this, "Cannot add dependency \"".concat(prettyPrintIdentifier(id), "\" after it is already resolved.")) || this;
  78. }
  79. return AddDependencyAfterResolutionError;
  80. }(RediError));
  81. var DeleteDependencyAfterResolutionError = /** @class */ (function (_super) {
  82. __extends(DeleteDependencyAfterResolutionError, _super);
  83. function DeleteDependencyAfterResolutionError(id) {
  84. return _super.call(this, "Cannot dependency dependency \"".concat(prettyPrintIdentifier(id), "\" after it is already resolved.")) || this;
  85. }
  86. return DeleteDependencyAfterResolutionError;
  87. }(RediError));
  88. /**
  89. *
  90. */
  91. var Injector = /** @class */ (function () {
  92. /**
  93. * Create a new `Injector` instance
  94. * @param dependencies Dependencies that should be resolved by this injector instance.
  95. * @param parent Optional parent injector.
  96. */
  97. function Injector(dependencies, parent) {
  98. if (parent === void 0) { parent = null; }
  99. this.parent = parent;
  100. this.children = [];
  101. this.resolutionOngoing = 0;
  102. this.disposed = false;
  103. this.dependencyCollection = new DependencyCollection(dependencies || []);
  104. this.resolvedDependencyCollection = new ResolvedDependencyCollection();
  105. if (parent) {
  106. parent.children.push(this);
  107. }
  108. }
  109. /**
  110. * Create a child inject with a set of dependencies.
  111. * @param dependencies Dependencies that should be resolved by the newly created child injector.
  112. * @returns The child injector.
  113. */
  114. Injector.prototype.createChild = function (dependencies) {
  115. this._ensureInjectorNotDisposed();
  116. return new Injector(dependencies, this);
  117. };
  118. /**
  119. * Dispose the injector and all dependencies held by this injector. Note that its child injectors will dispose first.
  120. */
  121. Injector.prototype.dispose = function () {
  122. // Dispose child injectors first.
  123. this.children.forEach(function (c) { return c.dispose(); });
  124. this.children.length = 0;
  125. // Call `dispose` method on each instantiated dependencies if they are `IDisposable` and clear collections.
  126. this.dependencyCollection.dispose();
  127. this.resolvedDependencyCollection.dispose();
  128. this.deleteSelfFromParent();
  129. this.disposed = true;
  130. };
  131. Injector.prototype.deleteSelfFromParent = function () {
  132. if (this.parent) {
  133. var index = this.parent.children.indexOf(this);
  134. if (index > -1) {
  135. this.parent.children.splice(index, 1);
  136. }
  137. }
  138. };
  139. /**
  140. * Add a dependency or its instance into injector. It would throw an error if the dependency
  141. * has already been instantiated.
  142. *
  143. * @param dependency The dependency or an instance that would be add in the injector.
  144. */
  145. Injector.prototype.add = function (dependency) {
  146. this._ensureInjectorNotDisposed();
  147. var identifierOrCtor = dependency[0];
  148. var item = dependency[1];
  149. if (this.resolvedDependencyCollection.has(identifierOrCtor)) {
  150. throw new AddDependencyAfterResolutionError(identifierOrCtor);
  151. }
  152. if (typeof item === 'undefined') {
  153. // Add dependency
  154. this.dependencyCollection.add(identifierOrCtor);
  155. }
  156. else if (isAsyncDependencyItem(item) ||
  157. isClassDependencyItem(item) ||
  158. isValueDependencyItem(item) ||
  159. isFactoryDependencyItem(item)) {
  160. // Add dependency
  161. this.dependencyCollection.add(identifierOrCtor, item);
  162. }
  163. else {
  164. // Add instance
  165. this.resolvedDependencyCollection.add(identifierOrCtor, item);
  166. }
  167. };
  168. /**
  169. * Replace an injection mapping for interface-based injection. It would throw an error if the dependency
  170. * has already been instantiated.
  171. *
  172. * @param dependency The dependency that will replace the already existed dependency.
  173. */
  174. Injector.prototype.replace = function (dependency) {
  175. this._ensureInjectorNotDisposed();
  176. var identifier = dependency[0];
  177. if (this.resolvedDependencyCollection.has(identifier)) {
  178. throw new AddDependencyAfterResolutionError(identifier);
  179. }
  180. this.dependencyCollection.delete(identifier);
  181. if (dependency.length === 1) {
  182. this.dependencyCollection.add(identifier);
  183. }
  184. else {
  185. this.dependencyCollection.add(identifier, dependency[1]);
  186. }
  187. };
  188. /**
  189. * Delete a dependency from an injector. It would throw an error when the deleted dependency
  190. * has already been instantiated.
  191. *
  192. * @param identifier The identifier of the dependency that is supposed to be deleted.
  193. */
  194. Injector.prototype.delete = function (identifier) {
  195. this._ensureInjectorNotDisposed();
  196. if (this.resolvedDependencyCollection.has(identifier)) {
  197. throw new DeleteDependencyAfterResolutionError(identifier);
  198. }
  199. this.dependencyCollection.delete(identifier);
  200. };
  201. /**
  202. * Invoke a function with dependencies injected. The function could only get dependency from the injector
  203. * and other methods are not accessible for the function.
  204. *
  205. * @param cb the function to be executed
  206. * @param args arguments to be passed into the function
  207. * @returns the return value of the function
  208. */
  209. Injector.prototype.invoke = function (cb) {
  210. var _this = this;
  211. var args = [];
  212. for (var _i = 1; _i < arguments.length; _i++) {
  213. args[_i - 1] = arguments[_i];
  214. }
  215. this._ensureInjectorNotDisposed();
  216. var accessor = {
  217. get: function (id, quantityOrLookup, lookUp) {
  218. return _this._get(id, quantityOrLookup, lookUp);
  219. },
  220. };
  221. return cb.apply(void 0, __spreadArray([accessor], args, false));
  222. };
  223. /**
  224. * Check if the injector could initialize a dependency.
  225. *
  226. * @param id Identifier of the dependency
  227. */
  228. Injector.prototype.has = function (id) {
  229. var _a;
  230. return this.dependencyCollection.has(id) || ((_a = this.parent) === null || _a === void 0 ? void 0 : _a.has(id)) || false;
  231. };
  232. /**
  233. * Get dependency instance(s).
  234. *
  235. * @param id Identifier of the dependency
  236. * @param quantityOrLookup @link{Quantity} or @link{LookUp}
  237. * @param lookUp @link{LookUp}
  238. */
  239. Injector.prototype.get = function (id, quantityOrLookup, lookUp) {
  240. this._ensureInjectorNotDisposed();
  241. try {
  242. var newResult = this._get(id, quantityOrLookup, lookUp);
  243. if ((Array.isArray(newResult) && newResult.some(function (r) { return isAsyncHook(r); })) || isAsyncHook(newResult)) {
  244. throw new GetAsyncItemFromSyncApiError(id);
  245. }
  246. return newResult;
  247. }
  248. catch (e) {
  249. if (e instanceof DependencyNotFoundError) {
  250. clearResolvingStack();
  251. }
  252. throw e;
  253. }
  254. };
  255. Injector.prototype._get = function (id, quantityOrLookup, lookUp, toSelf) {
  256. var quantity = Quantity.REQUIRED;
  257. if (quantityOrLookup === Quantity.REQUIRED ||
  258. quantityOrLookup === Quantity.OPTIONAL ||
  259. quantityOrLookup === Quantity.MANY) {
  260. quantity = quantityOrLookup;
  261. }
  262. else {
  263. lookUp = quantityOrLookup;
  264. }
  265. if (!toSelf) {
  266. // see if the dependency is already resolved, return it and check quantity
  267. var cachedResult = this.getValue(id, quantity, lookUp);
  268. if (cachedResult !== NotInstantiatedSymbol) {
  269. return cachedResult;
  270. }
  271. }
  272. // see if the dependency can be instantiated by itself or its parent
  273. return this.createDependency(id, quantity, lookUp, !toSelf);
  274. };
  275. /**
  276. * Get a dependency in the async way.
  277. */
  278. Injector.prototype.getAsync = function (id) {
  279. this._ensureInjectorNotDisposed();
  280. var cachedResult = this.getValue(id, Quantity.REQUIRED);
  281. if (cachedResult !== NotInstantiatedSymbol) {
  282. return Promise.resolve(cachedResult);
  283. }
  284. var newResult = this.createDependency(id, Quantity.REQUIRED);
  285. if (!isAsyncHook(newResult)) {
  286. return Promise.resolve(newResult);
  287. }
  288. return newResult.whenReady();
  289. };
  290. /**
  291. * Instantiate a class. The created instance would not be held by the injector.
  292. */
  293. Injector.prototype.createInstance = function (ctor) {
  294. var customArgs = [];
  295. for (var _i = 1; _i < arguments.length; _i++) {
  296. customArgs[_i - 1] = arguments[_i];
  297. }
  298. this._ensureInjectorNotDisposed();
  299. return this._resolveClassImpl.apply(this, __spreadArray([ctor], customArgs, false));
  300. };
  301. Injector.prototype._resolveDependency = function (id, item, shouldCache) {
  302. if (shouldCache === void 0) { shouldCache = true; }
  303. var result;
  304. pushResolvingStack(id);
  305. try {
  306. if (isValueDependencyItem(item)) {
  307. result = this._resolveValueDependency(id, item);
  308. }
  309. else if (isFactoryDependencyItem(item)) {
  310. result = this._resolveFactory(id, item, shouldCache);
  311. }
  312. else if (isClassDependencyItem(item)) {
  313. result = this._resolveClass(id, item, shouldCache);
  314. }
  315. else if (isExistingDependencyItem(item)) {
  316. result = this._resolveExisting(id, item);
  317. }
  318. else {
  319. result = this._resolveAsync(id, item);
  320. }
  321. popupResolvingStack();
  322. }
  323. catch (e) {
  324. popupResolvingStack();
  325. throw e;
  326. }
  327. return result;
  328. };
  329. Injector.prototype._resolveExisting = function (id, item) {
  330. var thing = this.get(item.useExisting);
  331. this.resolvedDependencyCollection.add(id, thing);
  332. return thing;
  333. };
  334. Injector.prototype._resolveValueDependency = function (id, item) {
  335. var thing = item.useValue;
  336. this.resolvedDependencyCollection.add(id, thing);
  337. return thing;
  338. };
  339. Injector.prototype._resolveClass = function (id, item, shouldCache) {
  340. var _this = this;
  341. if (shouldCache === void 0) { shouldCache = true; }
  342. var ctor = item.useClass;
  343. var thing;
  344. if (item.lazy) {
  345. var idle_1 = new IdleValue(function () {
  346. _this._ensureInjectorNotDisposed();
  347. return _this._resolveClassImpl(ctor);
  348. });
  349. thing = new Proxy(Object.create(null), {
  350. get: function (target, key) {
  351. var _a;
  352. if (key in target) {
  353. return target[key]; // such as toString
  354. }
  355. // hack checking if it's a async loader
  356. if (key === 'whenReady') {
  357. return undefined;
  358. }
  359. var hasInstantiated = idle_1.hasRun();
  360. var thing = idle_1.getValue();
  361. if (!hasInstantiated) {
  362. (_a = item.onInstantiation) === null || _a === void 0 ? void 0 : _a.call(item, thing);
  363. }
  364. var property = thing[key];
  365. if (typeof property !== 'function') {
  366. return property;
  367. }
  368. property = property.bind(thing);
  369. target[key] = property;
  370. return property;
  371. },
  372. set: function (_target, key, value) {
  373. ;
  374. idle_1.getValue()[key] = value;
  375. return true;
  376. },
  377. });
  378. }
  379. else {
  380. thing = this._resolveClassImpl(ctor);
  381. }
  382. if (id && shouldCache) {
  383. this.resolvedDependencyCollection.add(id, thing);
  384. }
  385. return thing;
  386. };
  387. Injector.prototype._resolveClassImpl = function (ctor) {
  388. var extraParams = [];
  389. for (var _i = 1; _i < arguments.length; _i++) {
  390. extraParams[_i - 1] = arguments[_i];
  391. }
  392. this.markNewResolution(ctor);
  393. var declaredDependencies = getDependencies(ctor)
  394. .sort(function (a, b) { return a.paramIndex - b.paramIndex; })
  395. .map(function (descriptor) { return (__assign(__assign({}, descriptor), { identifier: normalizeForwardRef(descriptor.identifier) })); });
  396. var resolvedArgs = [];
  397. for (var _a = 0, declaredDependencies_1 = declaredDependencies; _a < declaredDependencies_1.length; _a++) {
  398. var dep = declaredDependencies_1[_a];
  399. // recursive happens here
  400. try {
  401. var thing_1 = this._get(dep.identifier, dep.quantity, dep.lookUp, dep.withNew);
  402. resolvedArgs.push(thing_1);
  403. }
  404. catch (error) {
  405. if (error instanceof DependencyNotFoundError) {
  406. throw new DependencyNotFoundForModuleError(ctor, dep.identifier, dep.paramIndex);
  407. }
  408. throw error;
  409. }
  410. }
  411. var args = __spreadArray([], extraParams, true);
  412. var firstDependencyArgIndex = declaredDependencies.length > 0
  413. ? declaredDependencies[0].paramIndex
  414. : args.length;
  415. if (args.length !== firstDependencyArgIndex) {
  416. console.warn("[redi]: Expect ".concat(firstDependencyArgIndex, " custom parameter(s) of ").concat(ctor.toString(), " but get ").concat(args.length, "."));
  417. var delta = firstDependencyArgIndex - args.length;
  418. if (delta > 0) {
  419. args = __spreadArray(__spreadArray([], args, true), new Array(delta).fill(undefined), true);
  420. }
  421. else {
  422. args = args.slice(0, firstDependencyArgIndex);
  423. }
  424. }
  425. var thing = new (ctor.bind.apply(ctor, __spreadArray(__spreadArray([void 0], args, false), resolvedArgs, false)))();
  426. this.markResolutionCompleted();
  427. return thing;
  428. };
  429. Injector.prototype._resolveFactory = function (id, item, shouldCache) {
  430. var _a;
  431. this.markNewResolution(id);
  432. var declaredDependencies = normalizeFactoryDeps(item.deps);
  433. var resolvedArgs = [];
  434. for (var _i = 0, declaredDependencies_2 = declaredDependencies; _i < declaredDependencies_2.length; _i++) {
  435. var dep = declaredDependencies_2[_i];
  436. try {
  437. var thing_2 = this._get(dep.identifier, dep.quantity, dep.lookUp, dep.withNew);
  438. resolvedArgs.push(thing_2);
  439. }
  440. catch (error) {
  441. if (error instanceof DependencyNotFoundError) {
  442. throw new DependencyNotFoundForModuleError(id, dep.identifier, dep.paramIndex);
  443. }
  444. throw error;
  445. }
  446. }
  447. var thing = item.useFactory.apply(null, resolvedArgs);
  448. if (shouldCache) {
  449. this.resolvedDependencyCollection.add(id, thing);
  450. }
  451. this.markResolutionCompleted();
  452. (_a = item === null || item === void 0 ? void 0 : item.onInstantiation) === null || _a === void 0 ? void 0 : _a.call(item, thing);
  453. return thing;
  454. };
  455. Injector.prototype._resolveAsync = function (id, item) {
  456. var _this = this;
  457. var asyncLoader = {
  458. __symbol: AsyncHookSymbol,
  459. whenReady: function () { return _this._resolveAsyncImpl(id, item); },
  460. };
  461. return asyncLoader;
  462. };
  463. Injector.prototype._resolveAsyncImpl = function (id, item) {
  464. var _this = this;
  465. return item.useAsync().then(function (thing) {
  466. // check if another promise has been resolved,
  467. // do not resolve the async item twice
  468. var resolvedCheck = _this.getValue(id);
  469. if (resolvedCheck !== NotInstantiatedSymbol) {
  470. return resolvedCheck;
  471. }
  472. var ret;
  473. if (Array.isArray(thing)) {
  474. var item_1 = thing[1];
  475. if (isAsyncDependencyItem(item_1)) {
  476. throw new AsyncItemReturnAsyncItemError(id);
  477. }
  478. else {
  479. ret = _this._resolveDependency(id, item_1);
  480. }
  481. }
  482. else if (isCtor(thing)) {
  483. ret = _this._resolveClassImpl(thing);
  484. }
  485. else {
  486. ret = thing;
  487. }
  488. _this.resolvedDependencyCollection.add(id, ret);
  489. return ret;
  490. });
  491. };
  492. Injector.prototype.getValue = function (id, quantity, lookUp) {
  493. var _this = this;
  494. if (quantity === void 0) { quantity = Quantity.REQUIRED; }
  495. var onSelf = function () {
  496. if (_this.dependencyCollection.has(id) &&
  497. !_this.resolvedDependencyCollection.has(id)) {
  498. return NotInstantiatedSymbol;
  499. }
  500. return _this.resolvedDependencyCollection.get(id, quantity);
  501. };
  502. var onParent = function () {
  503. if (_this.parent) {
  504. return _this.parent.getValue(id, quantity);
  505. }
  506. else {
  507. return NotInstantiatedSymbol;
  508. }
  509. };
  510. if (lookUp === LookUp.SKIP_SELF) {
  511. return onParent();
  512. }
  513. if (lookUp === LookUp.SELF) {
  514. return onSelf();
  515. }
  516. if (this.resolvedDependencyCollection.has(id) ||
  517. this.dependencyCollection.has(id)) {
  518. return onSelf();
  519. }
  520. return onParent();
  521. };
  522. Injector.prototype.createDependency = function (id, quantity, lookUp, shouldCache) {
  523. var _this = this;
  524. if (quantity === void 0) { quantity = Quantity.REQUIRED; }
  525. if (shouldCache === void 0) { shouldCache = true; }
  526. var onSelf = function () {
  527. var registrations = _this.dependencyCollection.get(id, quantity);
  528. var ret = null;
  529. if (Array.isArray(registrations)) {
  530. ret = registrations.map(function (dependencyItem) { return _this._resolveDependency(id, dependencyItem, shouldCache); });
  531. }
  532. else if (registrations) {
  533. ret = _this._resolveDependency(id, registrations, shouldCache);
  534. }
  535. return ret;
  536. };
  537. var onParent = function () {
  538. if (_this.parent) {
  539. return _this.parent.createDependency(id, quantity, undefined, shouldCache);
  540. }
  541. else {
  542. if (quantity === Quantity.OPTIONAL) {
  543. return null;
  544. }
  545. pushResolvingStack(id);
  546. throw new DependencyNotFoundError(id);
  547. }
  548. };
  549. if (lookUp === LookUp.SKIP_SELF) {
  550. return onParent();
  551. }
  552. if (id === Injector) {
  553. return this;
  554. }
  555. if (this.dependencyCollection.has(id)) {
  556. return onSelf();
  557. }
  558. return onParent();
  559. };
  560. Injector.prototype.markNewResolution = function (id) {
  561. this.resolutionOngoing += 1;
  562. if (this.resolutionOngoing >= MAX_RESOLUTIONS_QUEUED) {
  563. throw new CircularDependencyError(id);
  564. }
  565. };
  566. Injector.prototype.markResolutionCompleted = function () {
  567. this.resolutionOngoing -= 1;
  568. };
  569. Injector.prototype._ensureInjectorNotDisposed = function () {
  570. if (this.disposed) {
  571. throw new InjectorAlreadyDisposedError();
  572. }
  573. };
  574. return Injector;
  575. }());
  576. export { Injector };
  577. //# sourceMappingURL=injector.js.map