Files
discord-decomp/_bundle/Module592.js
T
2026-11-01 12:12:55 +02:00

46 lines
1.2 KiB
JavaScript

// Metro module 592 (f593).
export class ChangeListeners {
constructor() {
const _this = this;
this.listeners = new Set();
this.conditionalListeners = new Set();
this.add = (a0) => {
_this.listeners.add(a0);
};
this.remove = (a0) => {
_this.listeners.delete(a0);
_this.conditionalListeners.delete(a0);
};
this.addConditional = function addConditional(a0) {
let conditionalCallback2;
let r4 = arguments[1];
if (r4 === void 0) {
r4 = true;
}
conditionalCallback2 = void 0;
if (!(r4 && a0() === false)) {
conditionalCallback2 = () => {
if (a0() === false) {
_this.remove(conditionalCallback2);
}
};
_this.add(conditionalCallback2);
_this.conditionalListeners.add(conditionalCallback2);
}
};
this.removeAllConditional = () => {
_this.conditionalListeners.forEach((conditionalListener) => _this.listeners.delete(conditionalListener));
_this.conditionalListeners.clear();
};
}
has(a0) {
return this.listeners.has(a0);
}
hasAny() {
return this.listeners.size > 0;
}
invokeAll() {
this.listeners.forEach((listener) => listener());
}
}