I remember the IMS CP resource type also uses some "trick" to inject the needed js in the header.
Just to open the discussion to a related thing... I think it would be great to have some standard way to add onLoad and onUnload event listeners within Moodle, instead of having custom onLoad and onUnload js code here and there.
Eloy Lafuente (stronk7) added a comment - 23/Sep/08 03:55 PM - edited I remember the IMS CP resource type also uses some "trick" to inject the needed js in the header.
Just to open the discussion to a related thing... I think it would be great to have some standard way to add onLoad and onUnload event listeners within Moodle, instead of having custom onLoad and onUnload js code here and there.
Edited: just for referece there are some nive addlisteners funcions (js) in : http://cvs.moodle.org/contrib/plugins/course/format/topicstree/loadunload.js?revision=1.1
Ciao
to load just he libraries you need - and that is what IMS CP should be doing, instead of horrible hacks. Admittedly, IMS CP and other things have been around longer than require_js has.
Tim Hunt added a comment - 23/Sep/08 06:11 PM No, you need to do something like
require_js(array('yui_yahoo','yui_event'));
to load just he libraries you need - and that is what IMS CP should be doing, instead of horrible hacks. Admittedly, IMS CP and other things have been around longer than require_js has.
Eloy Lafuente (stronk7) added a comment - 23/Sep/08 06:15 PM Yup, but it's nice to know there are newer ways to do that properly. Thanks!
Just for reference:
Tim Hunt added a comment - 25/Sep/08 11:09 AM Editing this bug to reflect the scope of the work that needs to be done. The original task of changing to use require_js everywhere is now a subtask.
All content on this web site is made available under the GNU General Public License, unless otherwise stated.
Just to open the discussion to a related thing... I think it would be great to have some standard way to add onLoad and onUnload event listeners within Moodle, instead of having custom onLoad and onUnload js code here and there.
Edited: just for referece there are some nive addlisteners funcions (js) in : http://cvs.moodle.org/contrib/plugins/course/format/topicstree/loadunload.js?revision=1.1
Ciao