AutorÃa | Ultima modificación | Ver Log |
{"version":3,"file":"event.min.js","sources":["../src/event.js"],"sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see <http://www.gnu.org/licenses/>.\n\n/**\n * Global registry of core events that can be triggered/listened for.\n *\n * @module core/event\n * @copyright 2015 Damyon Wiese <damyon@moodle.com>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n * @si
nce 3.0\n */\n\nimport {notifyEditorContentRestored} from 'core_editor/events';\nimport {notifyFilterContentUpdated} from 'core_filters/events';\nimport {notifyFormSubmittedByJavascript} from 'core_form/events';\n\n// These are only imported for legacy.\nimport $ from 'jquery';\nimport Y from 'core/yui';\n\n// These are AMD only events - no backwards compatibility for new things.\n// Note: No new events should be created here.\nconst Events = {\n FORM_FIELD_VALIDATION: \"core_form-field-validation\"\n};\n\n/**\n * Load the legacy YUI module which defines events in M.core.event and return it.\n *\n * @method getLegacyEvents\n * @return {Promise}\n * @deprecated\n */\nconst getLegacyEvents = () => {\n const result = $.Deferred();\n window.console.warn(\"The getLegacyEvents function has been deprecated. Please update your code to use native events.\");\n\n Y.use('event', 'moodle-core-event', function() {\n result.resolve(window.M.core.event);\n });\n return result.promise();\n};\n\
n/**\n * Get a curried function to warn that a function has been moved and renamed\n *\n * @param {String} oldFunctionName\n * @param {String} newModule\n * @param {String} newFunctionName\n * @param {Function} newFunctionRef\n * @returns {Function}\n */\nconst getRenamedLegacyFunction = (oldFunctionName, newModule, newFunctionName, newFunctionRef) => (...args) => {\n window.console.warn(\n `The core/event::${oldFunctionName}() function has been moved to ${newModule}::${newFunctionName}. ` +\n `Please update your code to use the new module.`\n );\n\n return newFunctionRef(...args);\n};\n\nexport default {\n Events,\n getLegacyEvents,\n\n notifyEditorContentRestored: getRenamedLegacyFunction(\n 'notifyEditorContentRestored',\n 'core_editor/events',\n 'notifyEditorContentRestored',\n notifyEditorContentRestored\n ),\n\n notifyFilterContentUpdated: getRenamedLegacyFunction(\n 'notifyFilterContentUpdated',\n 'core_filters/eve
nts',\n 'notifyFilterContentUpdated',\n notifyFilterContentUpdated\n ),\n\n notifyFormSubmitAjax: getRenamedLegacyFunction(\n 'notifyFormSubmitAjax',\n 'core_form/events',\n 'notifyFormSubmittedByJavascript',\n notifyFormSubmittedByJavascript\n ),\n};\n"],"names":["getRenamedLegacyFunction","oldFunctionName","newModule","newFunctionName","newFunctionRef","window","console","warn","Events","FORM_FIELD_VALIDATION","getLegacyEvents","result","$","Deferred","use","resolve","M","core","event","promise","notifyEditorContentRestored","notifyFilterContentUpdated","notifyFormSubmitAjax","notifyFormSubmittedByJavascript"],"mappings":";;;;;;;;qKAgEMA,yBAA2B,CAACC,gBAAiBC,UAAWC,gBAAiBC,iBAAmB,kBAC9FC,OAAOC,QAAQC,KACX,0BAAmBN,yDAAgDC,uBAAcC,wEAI9EC,2CAGI,CACXI,OAxCW,CACXC,sBAAuB,8BAwCvBC,gBA9BoB,WACdC,OAASC,gBAAEC,kBACjBR,OAAOC,QAAQC,KAAK,gHAElBO,IAAI,QAAS,qBAAqB,WAChCH,OAAOI,QAAQV,OAAOW,EAAEC,KAAKC,UAE1BP,OAAOQ,WAyBdC,4BAA6BpB,yBACzB,8BACA,qBACA,8BACAoB,qCAGJC,2BAA4BrB,
yBACxB,6BACA,sBACA,6BACAqB,qCAGJC,qBAAsBtB,yBAClB,uBACA,mBACA,kCACAuB"}