Loading jQuery plugin as AMD module?

Re: Loading jQuery plugin as AMD module?

by Gareth J Barnard -
Number of replies: 0
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers

In a theme (same sort of thing) as the file has AMD stuff, then put the minified version in the build folder: https://github.com/gjb2048/moodle-theme_shoehorn/blob/master/amd/build/chartist.min.js - then you can initialise from your own JS: https://github.com/gjb2048/moodle-theme_shoehorn/blob/master/amd/src/shoehorn_chart.js#L2 and then call that: https://github.com/gjb2048/moodle-theme_shoehorn/blob/master/layout/tiles/additionaljs.php#L89 with '$PAGE->requires->js_call_amd'.

https://docs.moodle.org/dev/Javascript_Modules is worth a read.

https://docs.moodle.org/dev/jQuery#What_about_JQuery_UI_.3F is worth a read too given jQueryUI.