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