Moodle 4 jQuery script works, but not in courseindex drawer

Re: Moodle 4 jQuery script works, but not in courseindex drawer

by Ferran Recio Calderó -
Number of replies: 0
Picture of Core developers Picture of Moodle HQ Picture of Peer reviewers Picture of Plugin developers Picture of Testers
It doe snot need to be inside a module. You just need to require the module inside the {{#js}} section of your mustache file:

{{#js}}
require(['core_courseformat/local/courseeditor'], function(editor) {
const currentCourse = editor.getCurrentCourseEditor();
});
{{/js}}