11 lines
395 B
TypeScript
11 lines
395 B
TypeScript
// Load view specific code
|
|
const currentView = document.body.dataset["currentView"];
|
|
|
|
if (currentView) {
|
|
// Import the module asynchronously; its top-level code runs on load
|
|
import(`./views/${currentView}.ts`)
|
|
// If the module exports an `init` function, call it
|
|
.then(module => module.init?.())
|
|
.catch(() => console.warn(`No module for view: ${currentView}`))
|
|
}
|