0-readme edit
javascript-modules
edit
How to embed a javascript module file in another file.
How to embed a Javascript file (module) into another Javascript file
File to import: importedScriptModule.js
export default function () {
... javascript code here ...
}
Main file. Conditional and event listener are optional.
async function doSomethingUseful() {
let { default: scriptmodule } = await import('./importedScriptModule.js');
scriptmodule();
}
if ( .. conditional .. ) {
doSomethingUseful();
window.addEventListener('resize', doSomethingUseful);
}