Skip to content

Commit c711f04

Browse files
committed
v-events => v-callbacks
1 parent 5d575cf commit c711f04

File tree

5 files changed

+21
-14
lines changed

5 files changed

+21
-14
lines changed

component.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,11 @@
2626
"src/config.js",
2727
"src/directive.js",
2828
"src/directives/attr.js",
29+
"src/directives/callbacks.js",
2930
"src/directives/class.js",
3031
"src/directives/cloak.js",
3132
"src/directives/component.js",
3233
"src/directives/el.js",
33-
"src/directives/events.js",
3434
"src/directives/html.js",
3535
"src/directives/if.js",
3636
"src/directives/index.js",

src/directives/events.js renamed to src/directives/callbacks.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ module.exports = {
88
var child = this.el.__vue__
99
if (!child || this.vm !== child.$parent) {
1010
_.warn(
11-
'`v-events` should only be used on a child component ' +
12-
'from the parent template.'
11+
'`v-callbacks` should only be used on a child ' +
12+
'component from the parent template.'
1313
)
1414
return
1515
}
@@ -18,7 +18,7 @@ module.exports = {
1818
update: function (handler, oldHandler) {
1919
if (typeof handler !== 'function') {
2020
_.warn(
21-
'Directive "v-events:' + this.expression + '" ' +
21+
'Directive "v-callbacks:' + this.expression + '" ' +
2222
'expects a function value.'
2323
)
2424
return

src/directives/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ exports.repeat = require('./repeat')
1919
exports['if'] = require('./if')
2020

2121
// child vm communication directives
22-
exports.events = require('./events')
22+
exports.callbacks = require('./callbacks')
2323

2424
// internal directives that should not be used directly
2525
// but we still want to expose them for advanced usage.

src/util/debug.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,13 @@ function enableDebug () {
6262
)
6363
return
6464
}
65+
if (id === 'events') {
66+
exports.warn(
67+
'v-events has been deprecated in ^0.12.0. ' +
68+
'Use v-callbacks instead.'
69+
)
70+
return
71+
}
6572
}
6673
if (!val) {
6774
exports.warn('Failed to resolve ' + type + ': ' + id)

test/unit/specs/directives/events_spec.js renamed to test/unit/specs/directives/callbacks_spec.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ var _ = require('../../../../src/util')
22
var Vue = require('../../../../src/vue')
33

44
if (_.inBrowser) {
5-
describe('v-events', function () {
5+
describe('v-callbacks', function () {
66

77
var el
88
beforeEach(function () {
@@ -11,10 +11,10 @@ if (_.inBrowser) {
1111
})
1212

1313
it('should register events', function () {
14-
var spy = jasmine.createSpy('v-events')
14+
var spy = jasmine.createSpy('v-callbacks')
1515
new Vue({
1616
el: el,
17-
template: '<test v-events="test:test"></test>',
17+
template: '<test v-callbacks="test:test"></test>',
1818
methods: {
1919
test: spy
2020
},
@@ -32,15 +32,15 @@ if (_.inBrowser) {
3232
it('should warn when used on non-root node', function () {
3333
new Vue({
3434
el: el,
35-
template: '<div v-events="test:test"></div>'
35+
template: '<div v-callbacks="test:test"></div>'
3636
})
3737
expect(hasWarned(_,
3838
'should only be used on a child component ' +
3939
'from the parent template')).toBe(true)
4040
})
4141

4242
it('should warn when used on child component root', function () {
43-
var spy = jasmine.createSpy('v-events')
43+
var spy = jasmine.createSpy('v-callbacks')
4444
new Vue({
4545
el: el,
4646
template: '<test></test>',
@@ -50,7 +50,7 @@ if (_.inBrowser) {
5050
components: {
5151
test: {
5252
replace: true,
53-
template: '<div v-events="test:test"></div>',
53+
template: '<div v-callbacks="test:test"></div>',
5454
compiled: function () {
5555
this.$emit('test')
5656
}
@@ -67,7 +67,7 @@ if (_.inBrowser) {
6767
var vm = new Vue({
6868
el: el,
6969
data: { test: 123 },
70-
template: '<test v-events="test:test"></test>',
70+
template: '<test v-callbacks="test:test"></test>',
7171
components: {
7272
test: {}
7373
}
@@ -79,7 +79,7 @@ if (_.inBrowser) {
7979
var vm = new Vue({
8080
el: el,
8181
data: {a:1},
82-
template: '<test v-events="test:a++"></test>',
82+
template: '<test v-callbacks="test:a++"></test>',
8383
components: {
8484
test: {
8585
compiled: function () {
@@ -104,7 +104,7 @@ if (_.inBrowser) {
104104
a++
105105
}
106106
},
107-
template: '<test v-events="test:handle"></test>',
107+
template: '<test v-callbacks="test:handle"></test>',
108108
components: {
109109
test: {
110110
compiled: function () {

0 commit comments

Comments
 (0)