Files
moodle/admin/tool/componentlibrary/content/library/moodle-javascript.md
T
Mikel Martín 0c586b41c1 MDL-75669 theme_boost: Fix BS5 related JS
- Migrate Boostrap components related JS from JQuery to vanilla JS.
- Migrate Boostrap components related Events from JQuery to vanilla JS.
2025-02-17 08:13:11 +01:00

1.2 KiB
Raw Blame History

layout, title, date, group, draft, menu
layout title date group draft menu
docs Moodle JavaScript 2020-01-14T13:38:37+01:00 moodle-components false main

Running AMD modules

When using this (shortcode) syntax you can showcase your HTML and add some RequireJS style Javascript that will call core AMD modules.

In order for this to work you need to use the JavaScript syntax used in core Mustache templates. See the {{js}} tags in this example below:

{{< example >}}

PlaceKitten Bootstrap 11 mins ago
Hello, world! This is a toast message.
{{#js}} require( [ 'theme_boost/toast', ], function( Toast ) { const toastTrigger = document.getElementById('toasttest'); new Toast(toastTrigger).show(); }); {{/js}} {{< /example >}}