jr-util
Version:
这是MJR的JS工具库。定期更新
17 lines (16 loc) • 311 B
JavaScript
class r {
constructor() {
this.listeners = {};
}
on(s, t) {
this.listeners[s] = this.listeners[s] || /* @__PURE__ */ new Set(), this.listeners[s].add(t);
}
emit(s, ...t) {
const e = this.listeners[s];
e && e.forEach((i) => i(...t));
}
}
const l = new r();
export {
l as default
};