[ Index ]

PHP Cross Reference of moodle-2.8

title

Body

[close]

/lib/yui/src/event/js/ -> event.js (source)

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


Generated: Fri Nov 28 20:29:05 2014 Cross-referenced by PHPXref 0.7.1