Back
Syntax
Study
Editor
Mode:
HTML
CSS
JavaScript
PHP
Reset
Run »
HTML / CSS / JS
// Load only when needed button.addEventListener("click", async () => { const { Chart } = await import("./chart.js"); new Chart(canvas, config); }); // Conditional loading if (userPreferences.showMap) { const { initMap } = await import("./map.js"); initMap(); } // With error handling try { const module = await import("./plugin.js"); module.init(); } catch (e) { console.error("Plugin load failed:", e); }
Result
Open