Skip to content

Commit 1b701b9

Browse files
committed
refactor: add intercepted in function, not plugin
1 parent b3c6833 commit 1b701b9

File tree

3 files changed

+9
-16
lines changed

3 files changed

+9
-16
lines changed

src/lib/add-intercepts.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// @flow
2+
3+
export default function addIntercepts (interceptedProperties: Object, Vue: Component) {
4+
Object.keys(interceptedProperties).forEach((key) => {
5+
Vue.prototype[key] = interceptedProperties[key]
6+
})
7+
}

src/lib/create-instance.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import Vue from 'vue'
44
import addSlots from './add-slots'
5-
import createInterceptPlugin from './create-intercept-plugin'
5+
import addIntercepts from './add-intercepts'
66
import addAttrs from './add-attrs'
77
import addListeners from './add-listeners'
88
import addProvide from './add-provide'
@@ -40,10 +40,7 @@ export default function createConstructor (component: Component, options: Option
4040
const Constructor = vue.extend(component)
4141

4242
if (options.intercept) {
43-
// creates a plugin that adds properties, and then install on local Constructor
44-
// this does not affect the base Vue class
45-
const interceptPlugin = createInterceptPlugin(options.intercept)
46-
Constructor.use(interceptPlugin)
43+
addIntercepts(options.intercept, Constructor)
4744
}
4845

4946
const vm = new Constructor(options)

src/lib/create-intercept-plugin.js

Lines changed: 0 additions & 11 deletions
This file was deleted.

0 commit comments

Comments
 (0)