You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
613 B
19 lines
613 B
const fetch = (url) => new Promise((resolve, reject) => {
|
|
const listener = ({ srcElement: req }) => {
|
|
req.status === 200 ? resolve(req.responseText) : reject("busted");
|
|
};
|
|
|
|
const req = new XMLHttpRequest();
|
|
req.addEventListener('load', listener);
|
|
req.open('GET', url);
|
|
req.send();
|
|
});
|
|
|
|
const main = function(strData) {
|
|
const json = JSON.parse(strData);
|
|
const metaMatrix = Matrices.buildMetaMatrix(json, "1930");
|
|
const chordMatrix = Matrices.buildChordMatrix(json, "1930");
|
|
Diagram.build("1930", json, metaMatrix, chordMatrix);
|
|
}
|
|
|
|
fetch('worldcup.json').then(main);
|
|
|