Skip to content

Instantly share code, notes, and snippets.

@dimasmds
Created December 2, 2024 07:41
Show Gist options
  • Select an option

  • Save dimasmds/8db69a3584fc89a5e0e8ead01a904b3d to your computer and use it in GitHub Desktop.

Select an option

Save dimasmds/8db69a3584fc89a5e0e8ead01a904b3d to your computer and use it in GitHub Desktop.
web intermediate code suggestion - 1 (improve initial script load)
import App from './app.js';
document.addEventListener('DOMContentLoaded', async () => {
const content = document.querySelector('#content');
const app = new App({ content });
await app.renderPage();
window.addEventListener('hashchange', async () => {
await app.renderPage();
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment