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

27 lines
890 B
JavaScript

// Metro module 648 (f649).
import batchEmitChanges from "./batchEmitChanges";
export class BatchedStoreListener {
handleStoreChange = () => {
const changeSentinel = batchEmitChanges.getChangeSentinel();
if (this.storeVersionHandled !== changeSentinel) {
this.changeCallback();
this.storeVersionHandled = changeSentinel;
}
};
constructor(a0, a1) {
this.stores = a0;
this.changeCallback = a1;
}
attach(c12418_0) {
this.stores.forEach((store, index) => {
if (store == null) {
throw new Error(`${c12418_0} tried to load a non-existent store. Either it isn't defined or there is a circular dependency. Loaded ${index} stores before error.`);
}
store.addReactChangeListener(this.handleStoreChange);
});
}
detach() {
this.stores.forEach((store) => store.removeReactChangeListener(this.handleStoreChange));
}
}