这是仿照发布者-订阅者模式的插件
npm i 'publishsubscribemoshi'
导入:import { Dispatch } from 'publishsubscribemoshi/dist/index'
- on: ( name:string,fn:Function ) => void 订阅/监听
- emit: ( name:string, ...arg:Array ) => void 发布/注册
- off: (name:string,fn:Function) => void 解除绑定
- once: (name:string,fn:Function) => void 只执行一次