Created
March 6, 2021 20:22
-
-
Save nitayneeman/5b6396db1a5a5e2299b7f3a77beba7b8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<body> | |
<a href="#module1">Module 1</a> | |
<a href="#module2">Module 2</a> | |
<script> | |
window.addEventListener('hashchange', async () => { | |
const route = window.location.hash.substr(1); | |
const { myFunction } = await import(`./${route}.mjs`); | |
myFunction(); | |
}); | |
</script> | |
</body> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment