智能照明系统APP-本地串口
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.
 
 
 
 
 
 
LightingSystemApp-serial/.svn/pristine/82/8217faa4190bc78fff57b2f607f...

28 lines
593 B

import Vue from 'vue'
const getEmitter = (function () {
let Emitter
return function getUniEmitter () {
if (!Emitter) {
Emitter = new Vue()
}
return Emitter
}
})()
function apply (ctx, method, args) {
return ctx[method].apply(ctx, args)
}
export function $on () {
return apply(getEmitter(), '$on', [...arguments])
}
export function $off () {
return apply(getEmitter(), '$off', [...arguments])
}
export function $once () {
return apply(getEmitter(), '$once', [...arguments])
}
export function $emit () {
return apply(getEmitter(), '$emit', [...arguments])
}