Grabbed dndbeyond's source code

```
~/go/bin/sourcemapper -output ddb -jsurl https://media.dndbeyond.com/character-app/static/js/main.90aa78c5.js
```
This commit is contained in:
2025-05-28 11:50:03 -07:00
commit 8df9031d27
3592 changed files with 319051 additions and 0 deletions
@@ -0,0 +1,52 @@
import { getCurrentRulesEngineConfig } from '../config/utils';
export class BaseManager {
constructor(params = {}) {
this.randomId = 0; // helpful for debugging
this.setState = (newState) => {
var _a;
const state = newState || ((_a = getCurrentRulesEngineConfig().store) === null || _a === void 0 ? void 0 : _a.getState()) || null;
this.state = state;
};
this.getState = () => this.state || null;
this.setDispatch = (newDispatch) => {
var _a;
const dispatch = newDispatch || ((_a = getCurrentRulesEngineConfig().store) === null || _a === void 0 ? void 0 : _a.dispatch) || null;
if (dispatch) {
this.dispatch = dispatch;
}
};
this.getDispatch = () => this.dispatch;
this.setState(params.state);
this.setDispatch(params.dispatch);
this.subscribeToStateUpdates(function init() { });
// this random id can be used to help debug if there are more than one instance
this.randomId = Math.floor(Math.random() * 1000000);
this.name = 'BaseManager';
}
updateState() {
const store = getCurrentRulesEngineConfig().store;
if (store) {
this.setState(store.getState());
}
}
subscribeToStateUpdates(callback) {
if (getCurrentRulesEngineConfig().store) {
const store = getCurrentRulesEngineConfig().store;
if (this.unsubscribe) {
this.unsubscribe();
}
this.unsubscribe = store === null || store === void 0 ? void 0 : store.subscribe(() => {
this.setState(store.getState());
if (callback) {
callback();
}
});
return this.unsubscribe;
}
return () => {
if (this.unsubscribe) {
this.unsubscribe();
}
};
}
}