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:
@@ -0,0 +1,44 @@
|
||||
import { ApiTypeEnum } from '../api/constants';
|
||||
import { NotificationTypeEnum } from '../notification';
|
||||
import { ConfigUtils } from './index';
|
||||
const defaultApiInfo = {
|
||||
[ApiTypeEnum.WEBSITE]: '',
|
||||
[ApiTypeEnum.GAME_DATA_SERVICE]: '',
|
||||
[ApiTypeEnum.CHARACTER_SERVICE]: '',
|
||||
};
|
||||
const defaultRulesEngineConfig = {
|
||||
apiInfo: defaultApiInfo,
|
||||
};
|
||||
export let rulesEngineConfig = {
|
||||
apiInfo: defaultApiInfo,
|
||||
messageBroker: null,
|
||||
characterId: 0,
|
||||
};
|
||||
/**
|
||||
*
|
||||
* @param config
|
||||
*/
|
||||
export function configureRulesEngine(config) {
|
||||
rulesEngineConfig = Object.assign(Object.assign(Object.assign({}, defaultRulesEngineConfig), rulesEngineConfig), config);
|
||||
function dispatchMessage(title, message, notificationType = NotificationTypeEnum.SUCCESS) {
|
||||
const rulesEngineConfig = ConfigUtils.getCurrentRulesEngineConfig();
|
||||
if (rulesEngineConfig === null || rulesEngineConfig === void 0 ? void 0 : rulesEngineConfig.onNotification) {
|
||||
rulesEngineConfig.onNotification(title, message, notificationType);
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
*
|
||||
*/
|
||||
export function getCurrentRulesEngineConfig() {
|
||||
return rulesEngineConfig;
|
||||
}
|
||||
const dummyDispatch = (action) => {
|
||||
console.warn('Dispatch was called before store was initialized.');
|
||||
console.log(action);
|
||||
return action;
|
||||
};
|
||||
export function getDispatch() {
|
||||
var _a;
|
||||
return ((_a = getCurrentRulesEngineConfig().store) === null || _a === void 0 ? void 0 : _a.dispatch) || dummyDispatch;
|
||||
}
|
||||
Reference in New Issue
Block a user