// Simple XHR wrapper returning a promise (for IE11-compatibility)
export function simpleFetch(path) {
    return new Promise((resolve, reject) => {
        const httpRequest = new XMLHttpRequest();
        httpRequest.onreadystatechange = () => {
            if (httpRequest.readyState === 4 && httpRequest.status >= 200 && httpRequest.status < 300) {
                resolve(httpRequest.responseText);
            }
            else if (httpRequest.readyState === 4) {
                reject('Could not complete request');
            }
        };
        httpRequest.onerror = () => reject('Could not complete request');
        httpRequest.open('GET', path);
        httpRequest.send();
    });
}
