New source found from dndbeyond.com

This commit is contained in:
2026-07-08 01:00:09 -07:00
parent 9a983a6d7b
commit dcefa0d2f2
2865 changed files with 222467 additions and 49053 deletions
@@ -1,4 +1,6 @@
import { HelperUtils } from "../engine/Helper";
import { getCurrentRulesEngineConfig } from '../config/utils';
export const subscriptionsMap = new Map();
export class BaseManager {
constructor(params = {}) {
this.randomId = 0; // helpful for debugging
@@ -50,3 +52,26 @@ export class BaseManager {
};
}
}
// manage subscriptions
BaseManager.subscribeToUpdates = ({ onUpdate, shouldInit = true }) => {
// TODO: maybe from lib.
const mapKey = HelperUtils.generateGuid();
// connect to redux for updates
let unsubscribe;
if (getCurrentRulesEngineConfig().store) {
const store = getCurrentRulesEngineConfig().store;
unsubscribe = store === null || store === void 0 ? void 0 : store.subscribe(() => {
onUpdate();
});
}
subscriptionsMap.set(mapKey, onUpdate);
if (shouldInit) {
onUpdate();
}
return () => {
subscriptionsMap.delete(mapKey);
if (unsubscribe) {
unsubscribe();
}
};
};