on-demand release 2.9beta+
[moodle.git] / lib / yui / build / moodle-core-event / moodle-core-event.js
CommitLineData
cc90cedc
DW
1YUI.add('moodle-core-event', function (Y, NAME) {
2
3// This file is part of Moodle - http://moodle.org/
4//
5// Moodle is free software: you can redistribute it and/or modify
6// it under the terms of the GNU General Public License as published by
7// the Free Software Foundation, either version 3 of the License, or
8// (at your option) any later version.
9//
10// Moodle is distributed in the hope that it will be useful,
11// but WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13// GNU General Public License for more details.
14//
15// You should have received a copy of the GNU General Public License
16// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
17
18/**
19 * @module moodle-core-event
20 */
21
22var LOGNAME = 'moodle-core-event';
23
24/**
25 * List of published global JS events in Moodle. This is a collection
26 * of global events that can be subscribed to, or fired from any plugin.
27 *
441f94b2
DW
28 * @namespace M.core
29 * @class event
cc90cedc
DW
30 */
31M.core = M.core || {};
32
33M.core.event = {
441f94b2
DW
34 /**
35 * This event is triggered when a page has added dynamic nodes to a page
36 * that should be processed by the filter system. An example is loading
37 * user text that could have equations in it. MathJax can typeset the equations
38 * but only if it is notified that there are new nodes in the page that need processing.
39 * To trigger this event use M.core.Event.fire(M.core.Event.FILTER_CONTENT_UPDATED, {nodes: list});
40 *
41 * @event "filter-content-updated"
42 * @param nodes {Y.NodeList} List of nodes added to the DOM.
43 */
cc90cedc
DW
44 FILTER_CONTENT_UPDATED: "filter-content-updated"
45};
46
47
48var eventDefaultConfig = {
49 emitFacade: true,
50 defaultFn: function(e) {
51 },
52 preventedFn: function(e) {
53 },
54 stoppedFn: function(e) {
55 }
56};
57
441f94b2
DW
58// Publish all the events with a standard config.
59var key;
60for (key in M.core.event) {
61 if (M.core.event.hasOwnProperty(key)) {
62 Y.publish(M.core.event[key], eventDefaultConfig);
63 }
cc90cedc
DW
64}
65
441f94b2 66// Publish events with a custom config here.
cc90cedc
DW
67
68
69}, '@VERSION@', {"requires": ["event-custom"]});