Reduce circular dependencies caused by importing from indexes, the location of the validation models, and the location of areaKeys (close #6237)

This commit is contained in:
Quincy Morgan
2019-04-24 13:45:59 -07:00
parent 862eca9ddd
commit d01bb78707
158 changed files with 503 additions and 472 deletions
+4 -9
View File
@@ -6,6 +6,8 @@ import { select as d3_select } from 'd3-selection';
import { t, currentLocale, addTranslation, setLocale } from '../util/locale';
import { setAreaKeys } from './area_keys';
import { coreHistory } from './history';
import { coreValidator } from './validator';
import { dataLocales, dataEn } from '../../data';
@@ -19,13 +21,6 @@ import { utilDetect } from '../util/detect';
import { utilCallWhenIdle, utilKeybinding, utilRebind, utilStringQs } from '../util';
export var areaKeys = {};
export function setAreaKeys(value) {
areaKeys = value;
}
export function coreContext() {
var dispatch = d3_dispatch('enter', 'exit', 'change');
var context = utilRebind({}, dispatch, 'on');
@@ -554,11 +549,11 @@ export function coreContext() {
var external = utilStringQs(window.location.hash).presets;
presets.fromExternal(external, function(externalPresets) {
context.presets = function() { return externalPresets; }; // default + external presets...
areaKeys = presets.areaKeys();
setAreaKeys(presets.areaKeys());
});
} else {
presets.init();
areaKeys = presets.areaKeys();
setAreaKeys(presets.areaKeys());
}
return context;