import { MittEvent } from '@uniczjc/event'
const Mitt = new UEvent()
// 拦截器
Mitt.beforeEach(type, next) {
console.log(type)
next()
}
// 监控
Mitt.on('update', (ev) => {
console.log(ev)
})
// 绑定
Mitt.emit('update', 'test')
// 解绑
Mitt.off('update')
// 解绑全部
Mitt.off()
// 销毁
Mitt.destroy()
import UEvent from '@uniczjc/event'
import { Swipe } from '@uniczjc/action' // 预设的手势action
const el = document.getElementById('ID')
const UV = new UEvent(el)
UV.use(Swipe, {name: 'swipe'})
// 监控
UV.on('swipe', (ev) => {
console.log(ev)
})
UV.on('updateend', (ev) => {
})
// 获取事件信息
const uOption = UV.get('swipe')
// 修改事件状态
uOption.disabled = true // 禁用事件