@blocknote/core
Version:
A "Notion-style" block-based extensible text editor built on top of Prosemirror and Tiptap.
28 lines (27 loc) • 821 B
JavaScript
var h = Object.defineProperty;
var b = (a, s, l) => s in a ? h(a, s, { enumerable: !0, configurable: !0, writable: !0, value: l }) : a[s] = l;
var t = (a, s, l) => b(a, typeof s != "symbol" ? s + "" : s, l);
class f {
constructor() {
// eslint-disable-next-line @typescript-eslint/ban-types
t(this, "callbacks", {});
}
on(s, l) {
return this.callbacks[s] || (this.callbacks[s] = []), this.callbacks[s].push(l), () => this.off(s, l);
}
emit(s, ...l) {
const c = this.callbacks[s];
c && c.forEach((i) => i.apply(this, l));
}
off(s, l) {
const c = this.callbacks[s];
c && (l ? this.callbacks[s] = c.filter((i) => i !== l) : delete this.callbacks[s]);
}
removeAllListeners() {
this.callbacks = {};
}
}
export {
f as E
};
//# sourceMappingURL=EventEmitter-CjSwpTbz.js.map