General developer forum

[Moodle 3.2] How do I include a third party js non-AMD js file in my page?

 
Picture of tim st.clair
Re: [Moodle 3.2] How do I include a third party js non-AMD js file in my page?
Group Plugin developers

Can you put it back at the window level by first using the amd loader to load jquery (haven't tried)

$PAGE->requires->js_call_amd('myblock/stub', 'init');

then having your stub

define(['jquery'], function($) {

var init = function () {

window.$ = $;

}
})

then calling your plugin via:

$PAGE->requires->js('plugin-path');

 
Average of ratings: -