Skip to content

Instantly share code, notes, and snippets.

@goofmint
Created July 2, 2019 12:13
Show Gist options
  • Select an option

  • Save goofmint/10b08de84921145c143820e0f703bee5 to your computer and use it in GitHub Desktop.

Select an option

Save goofmint/10b08de84921145c143820e0f703bee5 to your computer and use it in GitHub Desktop.
link.addEventListener('click', async (event) => {
event.preventDefault();
try {
const module = await import(`/${link.dataset.entryModule}.mjs`);
// The module exports a function named `loadPageInto`.
module.loadPageInto(main);
} catch (error) {
main.textContent = error.message;
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment