MDL-70990 core_filter: Add new native filterContentUpdated event
authorAndrew Nicols <andrew@nicols.co.uk>
Mon, 17 May 2021 07:09:19 +0000 (15:09 +0800)
committerAndrew Nicols <andrew@nicols.co.uk>
Wed, 26 May 2021 02:47:15 +0000 (10:47 +0800)
commitd4c6ac20c7d1d16da20f502681510732457adb2e
tree75ac2fe89b2a0ba1a6736f129037c9e8a6665ba7
parenta44cee78f18f7714e4467519b4f3a8224c948383
MDL-70990 core_filter: Add new native filterContentUpdated event

The legacy M.core.event.FILTER_CONTENT_UPDATED event has been replaced with a
new core_filter/events::filterContentUpdated native DOM event.

The new event can be triggered using the `notifyFilterContentUpdated`
function, and by providing with an Array containing the HTMLElements
that were updated, for example:

```
import {notifyFilterContentUpdated} from 'core_filter/events';

const someHandler = e => {
    // ...
    const nodeList = Array.from(document.querySelectorAll('div'));
    notifyFilterContentUpdated(nodeList);
};
```

The new event can be listened to at any point in the DOM using the
following syntax:

```
import {eventTypes} from 'core_filter/events';

const handler = e => {
    // The list of HTMLElements in an Array.
    e.detail.nodes;
};

document.addEventListener(eventTypes.filterContentUpdated, handler);
```

A backward-compatabibility layer is included to ensure that any legacy
YUI event listener, or jQuery event listener are still called with the
same arguments.

This legacy bridges will be removed after Moodle 4.3.
16 files changed:
filter/amd/build/events.min.js [new file with mode: 0644]
filter/amd/build/events.min.js.map [new file with mode: 0644]
filter/amd/src/events.js [new file with mode: 0644]
lib/amd/build/event.min.js
lib/amd/build/event.min.js.map
lib/amd/build/modal.min.js
lib/amd/build/modal.min.js.map
lib/amd/build/templates.min.js
lib/amd/build/templates.min.js.map
lib/amd/src/event.js
lib/amd/src/modal.js
lib/amd/src/templates.js
lib/upgrade.txt
media/player/videojs/amd/build/loader.min.js
media/player/videojs/amd/build/loader.min.js.map
media/player/videojs/amd/src/loader.js