]> git.ardis.lu - minimal-routing/commitdiff
Use event listener instead of attribute
authorArdis Lu <ardisglu@gmail.com>
Sat, 8 Oct 2022 01:51:18 +0000 (18:51 -0700)
committerArdis Lu <ardisglu@gmail.com>
Sat, 8 Oct 2022 01:51:18 +0000 (18:51 -0700)
index.html

index 11a92388483ef89e9e4c845df9c1ad5519b50b08..bd6b8d1d20f5c899da80e9b8809cfbc5098c7385 100644 (file)
         route(e.target.dataset.route);
       });
     }
-    window.onpopstate = _ => showPage(window.location.pathname.substring(1));
+    window.addEventListener('popstate', _ => showPage(window.location.pathname.substring(1)));
 
     // Show the current URL (to support direct linking aka deep links)
     showPage(window.location.pathname.substring(1));
This page took 0.042632 seconds and 4 git commands to generate.