mapcomplete/Customizations/SharedTagRenderings.ts

33 lines
885 B
TypeScript
Raw Normal View History

2020-10-27 00:01:34 +00:00
import TagRenderingConfig from "./JSON/TagRenderingConfig";
import * as questions from "../assets/tagRenderings/questions.json";
import * as icons from "../assets/tagRenderings/icons.json";
2020-10-27 00:01:34 +00:00
export default class SharedTagRenderings {
public static SharedTagRendering = SharedTagRenderings.generatedSharedFields();
private static generatedSharedFields() {
const dict = {}
function add(key, store){
2020-10-27 00:01:34 +00:00
try {
dict[key] = new TagRenderingConfig(store[key])
2020-10-27 00:01:34 +00:00
} catch (e) {
console.error("BUG: could not parse", key, " from questions.json or icons.json", e)
2020-10-27 00:01:34 +00:00
}
}
for (const key in questions) {
add(key, questions);
}
for (const key in icons) {
add(key, icons);
}
2020-10-27 00:01:34 +00:00
return dict;
}
}