Forum Discussion
JavaScript libaries
At the risk of showing my ignorance (which is legendary), can I ask a question on this topic? If the JavaScript library you are wanting to load has an ESM module format version, isn't it simpler to load it via an 'import' statement in the JavaScript code trigger? e.g.
async function loadMods() {
await import("https://unpkg.com/pdf-lib/dist/pdf-lib.js");
}
I appreciate this function may itself have to be called from an async function. but this worked for me when loading the latest pdf-lib,js library into my notetaker demo I posted a few weeks ago.
By dynamically loading the library in this way there is no need to modify the index.html file at all. Which makes it a whole lot simpler if you are thinking of embedding the Storyline into RISE for example.
With my WebObject solution you neither have to change the index.html. All is loaded automatically.
When you are certain online sources will stay and remain available...and donot run into Cors issues on the LMS, then your solution works fine. Benefit from the WebObject solution is, that it is always available, and will not be changed or updated if you donot want to.
- PhilMayor3 years agoSuper Hero
I prefer the solution Math describes in six months time when you republish you don’t need to remember to edit a file or drop files into the exported scorm. It is foolproof and avoids embarrassment.
Sent from my iPhone
Related Content
- 6 months ago