Rev 1 | AutorÃa | Comparar con el anterior | Ultima modificación | Ver Log |
{"version":3,"file":"events.min.js","sources":["../../../src/local/inplace_editable/events.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 * Inplace editable module events\n *\n * @module core/local/inplace_editable/events\n * @copyright 2021 Paul Holden <paulh@moodle.com>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL
v3 or later\n */\n\nimport {dispatchEvent} from 'core/event_dispatcher';\n\n/**\n * Module events\n *\n * @constant\n * @property {String} elementUpdated See {@link event:core/inplace_editable:updated}\n * @property {String} elementUpdateFailed See {@link event:core/inplace_editable:updateFailed}\n */\nexport const eventTypes = {\n\n /**\n * Event triggered when an element has been updated\n *\n * @event core/inplace_editable:updated\n * @type {CustomEvent}\n * @property {HTMLElement} target The element that was updated\n * @property {Object} detail\n * @property {Object} detail.ajaxreturn The data returned from the update AJAX request\n * @property {String} detail.oldvalue The previous value of the element\n */\n elementUpdated: 'core/inplace_editable:updated',\n\n /**\n * Event triggered when an element update has failed\n *\n * @event core/inplace_editable:updateFailed\n * @type {CustomEvent}\n * @property {HTMLElement} target The element t
hat failed to update\n * @property {Object} detail\n * @property {Object} detail.exception The raised exception\n * @property {String} detail.newvalue The intended value of the element\n */\n elementUpdateFailed: 'core/inplace_editable:updateFailed',\n};\n\n/**\n * Notify element of successful update\n *\n * @method\n * @param {HTMLElement} element The element that was updated\n * @param {Object} ajaxreturn The data returned from the update AJAX request\n * @param {String} oldvalue The previous value of the element\n * @returns {CustomEvent}\n * @fires event:core/inplace_editable:updated\n */\nexport const notifyElementUpdated = (element, ajaxreturn, oldvalue) => dispatchEvent(\n eventTypes.elementUpdated,\n {\n ajaxreturn,\n oldvalue,\n },\n element\n);\n\n/**\n * Notify element of failed update\n *\n * @method\n * @param {HTMLElement} element The element that failed to update\n * @param {Object} exception The raised exception\n * @param {String} newvalue The int
ended value of the element\n * @returns {CustomEvent}\n * @fires event:core/inplace_editable:updateFailed\n */\nexport const notifyElementUpdateFailed = (element, exception, newvalue) => dispatchEvent(\n eventTypes.elementUpdateFailed,\n {\n exception,\n newvalue,\n },\n element,\n {\n cancelable: true\n }\n);\n"],"names":["eventTypes","elementUpdated","elementUpdateFailed","element","ajaxreturn","oldvalue","exception","newvalue","cancelable"],"mappings":";;;;;;;;MAgCaA,WAAa,CAYtBC,eAAgB,gCAYhBC,oBAAqB,mGAaW,CAACC,QAASC,WAAYC,YAAa,mCACnEL,WAAWC,eACX,CACIG,WAAAA,WACAC,SAAAA,UAEJF,4CAaqC,CAACA,QAASG,UAAWC,YAAa,mCACvEP,WAAWE,oBACX,CACII,UAAAA,UACAC,SAAAA,UAEJJ,QACA,CACIK,YAAY"}