2021-02-12 07:32:08 +01:00
|
|
|
|
|
|
|
|
|
|
|
class HttpGetter {
|
|
|
|
async get(filename: string): Promise<any> {
|
|
|
|
const xhr = new XMLHttpRequest();
|
|
|
|
xhr.addEventListener('load', (e) => {
|
|
|
|
if (xhr.status === 200) {
|
|
|
|
console.log(xhr.responseText);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
console.log('failed with status ' + xhr.status + ': ' + xhr.statusText);
|
|
|
|
});
|
|
|
|
xhr.open('GET', filename);
|
|
|
|
xhr.send();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
export {
|
|
|
|
HttpGetter
|
|
|
|
};
|