UNPKG

silk-gui

Version:

GUI for developers and Node OS

36 lines (30 loc) 771 B
var _ = require('../util') module.exports = { acceptStatement: true, bind: function () { var child = this.el.__vue__ if (!child || this.vm !== child.$parent) { _.warn( '`v-events` should only be used on a child component ' + 'from the parent template.' ) return } }, update: function (handler, oldHandler) { if (typeof handler !== 'function') { _.warn( 'Directive "v-events:' + this.expression + '" ' + 'expects a function value.' ) return } var child = this.el.__vue__ if (oldHandler) { child.$off(this.arg, oldHandler) } child.$on(this.arg, handler) } // when child is destroyed, all events are turned off, // so no need for unbind here. }