You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
***node:** drop support for node 16 ([#71](https://github.com/nicojs/typed-inject/issues/71)) ([028cd45](https://github.com/nicojs/typed-inject/commit/028cd4553383521e9b7761bba327d545faabf4cc))
Copy file name to clipboardExpand all lines: README.md
+75-35Lines changed: 75 additions & 35 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,19 +14,18 @@ _If you are new to 'Dependency Injection'/'Inversion of control', please read up
14
14
15
15
_If you want to know more about how typed-inject works, please read [my blog article about it](https://medium.com/@jansennico/advanced-typescript-type-safe-dependency-injection-873426e2cc96)_
16
16
17
-
18
-
*[🗺️ Installation](#installation)
19
-
*[🎁 Usage](#usage)
20
-
*[💭 Motivation](#motivation)
21
-
*[🗝️ Typesafe? How?](#typesafe-how)
22
-
*[👶 Child injectors](#child-injectors)
23
-
*[🎄 Decorate your dependencies](#decorate-your-dependencies)
Create a child injector that can provide a value using instances of `Class` for token `'token'`. The new child injector can resolve all tokens the parent injector can, as well as the new `'token'`.
563
585
564
586
Scope is also supported here, for more info, see `provideFactory`.
Create a child injector that can provide exactly the same as the parent injector. Contrary to its `provideXxx` counterparts,this will create a new disposable scope without providing additional injectable values.
awaitscope.dispose(); // Dispose the scope, including instances of DisposableBaz
601
+
// Next task gets a fresh scope
602
+
}
603
+
}
604
+
```
605
+
566
606
#### `injector.dispose(): Promise<void>`
567
607
568
608
Use `dispose` to explicitly dispose the `injector`. This will result in the following (in order):
569
609
570
610
1. Call `dispose` on each child injector created from this injector.
571
-
2. It will call `dispose` on any dependency created by the injector (if it exists) using `provideClass` or `provideFactory` (**not** `provideValue` or `injectXXX`).
572
-
3. It will also await any promise that might have been returned by disposable dependencies.
611
+
2. It will call `dispose` on any dependency created by the injector (if it exists) using `provideClass` or `provideFactory` (**not** `provideValue` or `injectXXX`).
612
+
3. It will also await any promise that might have been returned by disposable dependencies.
573
613
574
614
_Note: this behavior changed since v2. Before v2, the parent injector was always disposed before the child injector._
575
615
_Note: this behavior changed again in v3, calling `dispose` on a child injector will **no longer** dispose it's parent injector and instead will dispose it's child injectors. The order of disposal is still child first._
0 commit comments