/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* Page.js :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: edbernar { if (response.status != 200) throw Error("Page '" + name + "' can't be loaded") return (response); }) .then(data => { data.text().then(text => { console.log("Page updated !"); document.body.innerHTML = text; this.actualPage = this.availablePages[i].class; document.title = this.availablePages[i].title; history.pushState({}, this.availablePages[i].title, this.availablePages[i].url); this.actualPage.create(); }) }) .catch(error => { throw Error(error); }); return ; } } throw Error("Page '" + page + "' not exist"); } #showUnknownPage() { document.body.innerHTML = "404 - Page not found"; } }; export { Page }