Skip to content

Commit 7f1ec67

Browse files
author
Jack Ellis
committed
feat: optional injection config
injecting components/directives/mixins are now optional and disabled by default BREKAING CHANGE: you must now manually enable components/directives/mixins
1 parent 93ca93d commit 7f1ec67

File tree

5 files changed

+2972
-457
lines changed

5 files changed

+2972
-457
lines changed

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,12 @@ The injector must be regstered on the Vue class:
148148
```javascript
149149
Vue.use(injector);
150150
```
151+
You can supply an options object to determine which properties will be injected.
152+
```js
153+
Vue.use(injector, { depnedencies: true, mixins: true, directives: true, components: true });
154+
```
155+
By default only `depnedencies` is enabled.
156+
151157
#### service(name, [dependencies], constructor)
152158
Registers a service. A service takes a constructor function (or an ES6 class). When a service is injected into a component, the constructor is instantiated.
153159
The dependencies option determine which dependencies to inject into the constructor. These will be passed into the function in the same order.
@@ -267,6 +273,8 @@ dependencies : { myAlias : 'myFactory' }
267273
```
268274
then in your component you can access the injected *myFactory* instance via `this.myAlias`.
269275

276+
> For the following methods, you must enable their related options when calling Vue.use
277+
270278
#### components
271279
If you register components on the injector you can then inject them into the components property:
272280
```javascript

0 commit comments

Comments
 (0)