28 lines
816 B
JavaScript
28 lines
816 B
JavaScript
// Dynamically loads libraries and bootstraps the application
|
|
(async ()=>{
|
|
// Add a loader here if any
|
|
const root = document.getElementById('root')
|
|
if(root) root.innerHTML= `<div style="align-self: center">My app has loaded!!</div>`;
|
|
|
|
try {
|
|
// Load app
|
|
const [
|
|
appModule,
|
|
] = await Promise.all([
|
|
import("./batman.js"),
|
|
]);
|
|
|
|
console.log("Bootstrapped, ready to go!");
|
|
|
|
// Wait for DOM to be ready
|
|
if(document.readyState === 'loading') {
|
|
await new Promise((resolve)=>document.addEventListener('DOMContentLoaded', resolve));
|
|
}
|
|
|
|
// Start the app!
|
|
root.innerHTML = `<div style="align-self: center"><b>${appModule.batman}</b></div>`;
|
|
}catch(err){
|
|
console.error(err);
|
|
}
|
|
})()
|