/** * Created by Mrzou on 2018/3/11. */ //实现简单的订阅与发布模式的代码块export function pattern() { let currentListeners = [] function subscribe(type, listener) { if ((typeof listener !== 'function') || (typeof listener !== 'string')) { throw new Error('参数类型错误') }