/** Provides an avenue of fetching resources via HTTP calls. */ function HttpGetter(): void {} /** * Fetches files using HTTP get requests. * * @param filename - The filename to fetch. * @returns The HTTP response text. */ HttpGetter.prototype.get = (filename) => new Promise((resolve, reject) => { const xhr: XMLHttpRequest = new XMLHttpRequest(); xhr.addEventListener('load', (e) => { if (xhr.status === 200) { resolve(xhr.responseText); return; } reject('failed with status ' + xhr.status + ': ' + xhr.statusText); }); xhr.open('GET', filename); xhr.send(); }); /** @exports */ export { HttpGetter };