require('@babel/polyfill');const{ createBrowserHistory }=require('history');constbrowser=require('@geum/browser');consthistory=createBrowserHistory();constapp=browser();constmenu=['<a href="/some/path?foo=bar">Some Path</a>','<a href="/some/other/path?foo=bar">Some Other Path</a>'];app.get('/some/path',function(req,res){res.target='#root';res.content=menu.join('')+'<h1>Some Path</h1>';});app.get('/some/other/path',function(req,res){res.target='#root';res.content=menu.join('')+'<h1>Some Other Path</h1>';});constrouteTo=(event)=>{consthref=this.getAttribute('href');consttarget=this.getAttribute('target');//if there is a target or it's an external linkif(target||href.includes('://')){//do nothingreturn;}event.preventDefault();history.push(href,{});returnfalse;}app.on('close',()=>{Array.from(document.querySelectorAll('#root a')).forEach(link=>{link.addEventListener('click',routeTo)});}).emit('close')history.listen(app);