Proyectos de Subversion Moodle

Rev

Rev 1 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 1 Rev 1441
Línea 28... Línea 28...
28
 * });
28
 * });
29
 */
29
 */
Línea 30... Línea 30...
30
 
30
 
31
import {dispatchEvent} from 'core/event_dispatcher';
31
import {dispatchEvent} from 'core/event_dispatcher';
32
import {getList as normalistNodeList} from 'core/normalise';
-
 
Línea 33... Línea 32...
33
import jQuery from 'jquery';
32
import {getList as normalistNodeList} from 'core/normalise';
34
 
33
 
35
/**
34
/**
36
 * Events for the `core_filters` subsystem.
35
 * Events for the `core_filters` subsystem.
Línea 88... Línea 87...
88
 * @fires filterContentRenderingComplete
87
 * @fires filterContentRenderingComplete
89
 */
88
 */
90
export const notifyFilterContentRenderingComplete = nodes => {
89
export const notifyFilterContentRenderingComplete = nodes => {
91
    return dispatchEvent(eventTypes.filterContentRenderingComplete, {nodes});
90
    return dispatchEvent(eventTypes.filterContentRenderingComplete, {nodes});
92
};
91
};
93
 
-
 
94
let legacyEventsRegistered = false;
-
 
95
if (!legacyEventsRegistered) {
-
 
96
    // The following event triggers are legacy and will be removed in the future.
-
 
97
    // The following approach provides a backwards-compatability layer for the new events.
-
 
98
    // Code should be updated to make use of native events.
-
 
99
 
-
 
100
    Y.use('event', 'moodle-core-event', () => {
-
 
101
        // Provide a backwards-compatability layer for YUI Events.
-
 
102
        document.addEventListener(eventTypes.filterContentUpdated, e => {
-
 
103
            // Trigger the legacy jQuery event.
-
 
104
            jQuery(document).trigger(M.core.event.FILTER_CONTENT_UPDATED, [jQuery(e.detail.nodes)]);
-
 
105
 
-
 
106
            // Trigger the legacy YUI event.
-
 
107
            Y.fire(M.core.event.FILTER_CONTENT_UPDATED, {nodes: new Y.NodeList(e.detail.nodes)});
-
 
108
        });
-
 
109
    });
-
 
110
 
-
 
111
    legacyEventsRegistered = true;
-
 
112
}
-