You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
437 B
24 lines
437 B
|
3 years ago
|
import Vue from 'vue'
|
||
|
|
|
||
|
|
const Emitter = new Vue()
|
||
|
|
|
||
|
|
function apply (ctx, method, args) {
|
||
|
|
return ctx[method].apply(ctx, args)
|
||
|
|
}
|
||
|
|
|
||
|
|
export function $on () {
|
||
|
|
return apply(Emitter, '$on', [...arguments])
|
||
|
|
}
|
||
|
|
|
||
|
|
export function $off () {
|
||
|
|
return apply(Emitter, '$off', [...arguments])
|
||
|
|
}
|
||
|
|
|
||
|
|
export function $once () {
|
||
|
|
return apply(Emitter, '$once', [...arguments])
|
||
|
|
}
|
||
|
|
|
||
|
|
export function $emit () {
|
||
|
|
return apply(Emitter, '$emit', [...arguments])
|
||
|
|
}
|