Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 563b063

Browse filesBrowse files
committed
better naming for internals
1 parent 9f37925 commit 563b063
Copy full SHA for 563b063

File tree

Expand file treeCollapse file tree

3 files changed

+29
-29
lines changed
Filter options
Expand file treeCollapse file tree

3 files changed

+29
-29
lines changed

‎src/directives/component.js

Copy file name to clipboardExpand all lines: src/directives/component.js
+12-12Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,11 @@ module.exports = {
4141
}
4242
// component resolution related state
4343
this._pendingCb =
44-
this.ctorId =
45-
this.Ctor = null
44+
this.componentID =
45+
this.Component = null
4646
// if static, build right now.
4747
if (!this._isDynamicLiteral) {
48-
this.resolveCtor(this.expression, _.bind(this.initStatic, this))
48+
this.resolveComponent(this.expression, _.bind(this.initStatic, this))
4949
} else {
5050
// check dynamic component params
5151
this.transMode = this._checkParam('transition-mode')
@@ -104,7 +104,7 @@ module.exports = {
104104
this.remove(this.childVM, afterTransition)
105105
this.unsetCurrent()
106106
} else {
107-
this.resolveCtor(value, _.bind(function () {
107+
this.resolveComponent(value, _.bind(function () {
108108
this.unbuild(true)
109109
var newComponent = this.build(data)
110110
/* istanbul ignore if */
@@ -126,11 +126,11 @@ module.exports = {
126126
* the child vm.
127127
*/
128128

129-
resolveCtor: function (id, cb) {
129+
resolveComponent: function (id, cb) {
130130
var self = this
131-
this._pendingCb = _.cancellable(function (ctor) {
132-
self.ctorId = id
133-
self.Ctor = ctor
131+
this._pendingCb = _.cancellable(function (component) {
132+
self.componentID = id
133+
self.Component = component
134134
cb()
135135
})
136136
this.vm._resolveComponent(id, this._pendingCb)
@@ -160,12 +160,12 @@ module.exports = {
160160

161161
build: function (data) {
162162
if (this.keepAlive) {
163-
var cached = this.cache[this.ctorId]
163+
var cached = this.cache[this.componentID]
164164
if (cached) {
165165
return cached
166166
}
167167
}
168-
if (this.Ctor) {
168+
if (this.Component) {
169169
var parent = this._host || this.vm
170170
var el = templateParser.clone(this.el)
171171
var child = parent.$addChild({
@@ -178,9 +178,9 @@ module.exports = {
178178
_asComponent: true,
179179
_isRouterView: this._isRouterView,
180180
_context: this.vm
181-
}, this.Ctor)
181+
}, this.Component)
182182
if (this.keepAlive) {
183-
this.cache[this.ctorId] = child
183+
this.cache[this.componentID] = child
184184
}
185185
return child
186186
}

‎src/directives/repeat.js

Copy file name to clipboardExpand all lines: src/directives/repeat.js
+14-14Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ module.exports = {
9999
var id = _.checkComponent(this.el, options)
100100
if (!id) {
101101
// default constructor
102-
this.Ctor = _.Vue
102+
this.Component = _.Vue
103103
// inline repeats should inherit
104104
this.inline = true
105105
// important: transclude with no options, just
@@ -109,7 +109,7 @@ module.exports = {
109109
copy._asComponent = false
110110
this._linkFn = compiler.compile(this.template, copy)
111111
} else {
112-
this.Ctor = null
112+
this.Component = null
113113
this.asComponent = true
114114
// check inline-template
115115
if (this._checkParam('inline-template') !== null) {
@@ -119,8 +119,8 @@ module.exports = {
119119
var tokens = textParser.parse(id)
120120
if (tokens) {
121121
// dynamic component to be resolved later
122-
var ctorExp = textParser.tokensToExp(tokens)
123-
this.ctorGetter = expParser.parse(ctorExp).get
122+
var componentExp = textParser.tokensToExp(tokens)
123+
this.componentGetter = expParser.parse(componentExp).get
124124
} else {
125125
// static
126126
this.componentId = id
@@ -131,11 +131,11 @@ module.exports = {
131131

132132
resolveComponent: function () {
133133
this.componentState = PENDING
134-
this.vm._resolveComponent(this.componentId, _.bind(function (Ctor) {
134+
this.vm._resolveComponent(this.componentId, _.bind(function (Component) {
135135
if (this.componentState === ABORTED) {
136136
return
137137
}
138-
this.Ctor = Ctor
138+
this.Component = Component
139139
this.componentState = RESOLVED
140140
this.realUpdate(this.pendingData)
141141
this.pendingData = null
@@ -165,19 +165,19 @@ module.exports = {
165165
for (key in meta) {
166166
_.define(context, key, meta[key])
167167
}
168-
var id = this.ctorGetter.call(context, context)
169-
var Ctor = _.resolveAsset(this.vm.$options, 'components', id)
168+
var id = this.componentGetter.call(context, context)
169+
var Component = _.resolveAsset(this.vm.$options, 'components', id)
170170
if (process.env.NODE_ENV !== 'production') {
171-
_.assertAsset(Ctor, 'component', id)
171+
_.assertAsset(Component, 'component', id)
172172
}
173-
if (!Ctor.options) {
173+
if (!Component.options) {
174174
process.env.NODE_ENV !== 'production' && _.warn(
175175
'Async resolution is not supported for v-repeat ' +
176176
'+ dynamic component. (component: ' + id + ')'
177177
)
178178
return _.Vue
179179
}
180-
return Ctor
180+
return Component
181181
},
182182

183183
/**
@@ -359,7 +359,7 @@ module.exports = {
359359
data = raw
360360
}
361361
// resolve constructor
362-
var Ctor = this.Ctor || this.resolveDynamicComponent(data, meta)
362+
var Component = this.Component || this.resolveDynamicComponent(data, meta)
363363
var parent = this._host || this.vm
364364
var vm = parent.$addChild({
365365
el: templateParser.clone(this.template),
@@ -373,14 +373,14 @@ module.exports = {
373373
// is this a component?
374374
_asComponent: this.asComponent,
375375
// linker cachable if no inline-template
376-
_linkerCachable: !this.inlineTemplate && Ctor !== _.Vue,
376+
_linkerCachable: !this.inlineTemplate && Component !== _.Vue,
377377
// pre-compiled linker for simple repeats
378378
_linkFn: this._linkFn,
379379
// identifier, shows that this vm belongs to this collection
380380
_repeatId: this.id,
381381
// transclusion content owner
382382
_context: this.vm
383-
}, Ctor)
383+
}, Component)
384384
// cache instance
385385
if (needCache) {
386386
this.cacheVm(raw, vm, index, this.converted ? meta.$key : null)

‎test/unit/specs/async_component_spec.js

Copy file name to clipboardExpand all lines: test/unit/specs/async_component_spec.js
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ describe('Async components', function () {
112112
function step1 () {
113113
// called after A resolves, but A should have been
114114
// invalidated so not cotrId should be set
115-
expect(vm._directives[0].ctorId).toBe(null)
115+
expect(vm._directives[0].componentID).toBe(null)
116116
}
117117
function step2 () {
118118
// B should resolve successfully
@@ -146,7 +146,7 @@ describe('Async components', function () {
146146
function next () {
147147
// called after A resolves, but A should have been
148148
// invalidated so not cotrId should be set
149-
expect(dir.ctorId).toBe(null)
149+
expect(dir.componentID).toBe(null)
150150
done()
151151
}
152152
})
@@ -282,7 +282,7 @@ describe('Async components', function () {
282282
vm.$destroy()
283283
function next () {
284284
expect(el.textContent).toBe('')
285-
expect(dir.Ctor).toBe(null)
285+
expect(dir.Component).toBe(null)
286286
done()
287287
}
288288
})

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.