Skip to content

The $on()’s callback is bound to the event object #130

@bpierre

Description

@bpierre
var vm = new Vue({
    created: function() {
        console.log(this === vm) // true

        this.$watch('foo', function() {
            console.log(this === vm) // true
        })

        this.$on('bar', function(value) {
            console.log(this === vm) // false
        })
    }
})

Shouldn’t this be the current VM here? Maybe the event could be passed as a second parameter.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions