mirror of
https://github.com/moodle/moodle.git
synced 2025-01-19 14:27:22 +01:00
31d6adef4d
The legacy M.core.event.BLOCK_CONTENT_UPDATED event has been replaced with a new core_block/events::blockContentUpdated native DOM event. The new event can be triggered using the `notifyBlockContentUpdated` event, and by providing the HTMLElement that was updated, for example: ``` import {notifyBlockContentUpdated} from 'core_block/events'; const someHandler = e => { // ... const updatedBlock = e.target.closest('.block'); notifyBlockContentUpdated(updatedBlock); }; ``` The new event can be listened to at any point in the DOM using the following syntax: ``` import {eventTypes} from 'core_block/events'; const handler = e => { // The block that was updated. e.target; // The id of the updated block. e.detail.instanceId; }; document.addEventListener(eventTypes.blockContentUpdated, handler); ``` A backward-compatabibility layer is included to ensure that any legacy YUI event listener is still called with the same arguments. This legacy bridges will be removed after Moodle 4.3.