class LocationService { async redirect(to, delay = 0) { return new Promise(res => { setTimeout(() => { window.location = to res() }, delay) }) } async back() { return window.history.back() } async reload(delay = 0) { return new Promise(res => { setTimeout(() => { window.location.reload() res() }, delay) }) } set_query(query) { if (history.pushState) { const new_url = window.location.protocol + "//" + window.location.host + window.location.pathname + '?' + query; window.history.pushState({path: new_url}, '', new_url); } } } const location_service = new LocationService() export { location_service }