export default class FileLoader { constructor(filename) { this.filename = filename; this.content = ''; this.loadContent(); } getContent() { return this.content; } loadContent() { let request = new XMLHttpRequest(); request.onreadystatechange = () => { if (request.status === 200 && request.readyState === 4) { this.content = request.responseText; } }; request.open('GET', this.filename, false); request.send(); } }