If you want to create a new page for developers, you should create it on the Moodle Developer Resource site.

Talk:Javascript Modules

From MoodleDocs
Revision as of 10:27, 11 May 2017 by Howard Miller (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

1. I have a third party javascript module which doesn't use an external framework (e.g. jQuery) and isn't an AMD module. I may only have the minified version of the module. I want to include it in my Moodle page. How do I do that?

2. Same question as above but the module is a jQuery non-AMD module. How do I include it?

The page reads to me like there should be a way to do that... it mentions that there is a way, but only describes what to do if the JavaScript file is an AMD module.

I asked this question in the developer forum and my understanding is that this can't be done. The point of AMD modules is to manage the loading of the required Javascript. For that to happen *everything* needs to be an AMD module. If you just load some other library separately you can't guarantee it will all load in the required order. You will see that some libraries have been re-packaged as AMD modules for use in Moodle. I am certainly no expert so don't take this as gospel --Howard Miller (talk) 18:27, 11 May 2017 (AWST)