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
Copy file name to clipboardExpand all lines: README.md
+4-3Lines changed: 4 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -273,7 +273,7 @@ export default class AuthService {
273
273
274
274
container.bind('authService').to(AuthService);
275
275
```
276
-
2. We have lots of [magic strings](http://deviq.com/magic-strings/) everywhere (e.g. what we would do if `authService` changes the name? How we prevent naming collisions). Well, ES6 introduced [symbols](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol) that we can use. Don't forget to export the Symbol:
276
+
2. We have lots of [magic strings](http://deviq.com/magic-strings/) everywhere (e.g. what we would do if `authService` changes the name? How we prevent naming collisions?). Well, ES6 introduced [symbols](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol) that we can use. Don't forget to export the symbol so it can be used later:
277
277
```js
278
278
importcontainerfrom'./di';
279
279
@@ -331,7 +331,7 @@ export default class AuthService {
331
331
332
332
```
333
333
334
-
If your service depends on other services, you can pass IDs as a second parameters:
334
+
If your service depends on other services, you can pass array of IDs as a second parameter:
@@ -350,10 +350,11 @@ export default class AuthService {
350
350
}
351
351
}
352
352
```
353
+
DI will ensure that the otherService will be instantiated first, using `OTHER_SERVICE_ID` to locate the constructor.
353
354
Check out documentation for [inversify-vanillajs-helpers](https://github.com/inversify/inversify-vanillajs-helpers#usage) to see all possibilities
354
355
355
356
### @LazyInject decorator
356
-
We can improve injection in our VUE components too by using LazyInject decorators from [inversify-inject-decorators](https://github.com/inversify/inversify-inject-decorators). Let's create it and export it in `di.js` first:
357
+
We can improve injection in our VUE components too, by using LazyInject decorators from [inversify-inject-decorators](https://github.com/inversify/inversify-inject-decorators). Let's create it and export it in `di.js` first:
0 commit comments