I don't use javascript in Moodle very often as it make me want to kill small animals, but once again I am totally confused...
Would someone kindly explain the difference between using $PAGE->requires->js() and $PAGE->requires->js_init_cal().
The latter appears to require the js to be much more structured (M.mod_something) whereas the former seems to be for much less stuctured code. I don't really understand why you would use one over the other. For example, the quiz module has a mixture of both.
This article - http://docs.moodle.org/dev/YUI - is very recent but misleading. I actually have no idea what it is talking about. The sort of YUI.add() or YUI().use() wrappers it talks about are not used anywhere in Moodle outside of the library APIs (granted at a quick glance).
EDIT:Here's another one - $PAGE->requires->yui_module - not used much but does turn up in Moodle 2.4
I seem to remember that this page - http://docs.moodle.org/dev/JavaScript_guidelines - used to be the one that explained how to use js_init_call() but is now much longer and explains using the yui_module / YUI.add() stuff - which isn't actually used anywhere. Huh?