Hey,
I'm currently working on a street map block plugin with some additional geolocation functionality (push latest geolocation via ajax to server and safe it in the $USER session variable). Depend on this plugin I also creating an availability plugin to restrict access by current geolocation - but this is another story.
To render the map I decided to use http://leafletjs.com/. Because both plugins needs leaflet I wrapped the lib into a YUI module like this: https://gist.github.com/jojoob/1f8f35b95d075b82c4e4
And this is how I use the module:
Y.use('M.block_geolocation.leaflet', function() {
M.block_geolocation.leaflet.load(function() {
// code that uses leaflet
}
})
Currently the YUI module lives under my block plugin and the leaflet code under lib/leaflet-0.7.3. It works but I don't think that's a good practice. I also tried to put the YUI code under lib/leaflet but it seems that moodle doesn't tell YUI about code in this directory. At least I was not able to load the module. Is there a standard way for doing stuff like this in moodle?
By the way is there a better way to wrap leaflet with YUI rather than explicit call 'load' and use the slightly ugly callback after Y.Get finished?
For those interested:
https://github.com/jojoob/moodle-block_geolocation
https://github.com/jojoob/moodle-availability_geolocation