{"version":3,"file":"events.min.js","sources":["https:\/\/lms.svhs.co\/blocks\/amd\/src\/events.js"],"sourcesContent":["\/\/ This file is part of Moodle - http:\/\/moodle.org\/ \/\/\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 .\n\n\/**\n * Javascript events for the `core_block` subsystem.\n *\n * @module core_block\/events\n * @copyright 2021 Andrew Nicols \n * @license http:\/\/www.gnu.org\/copyleft\/gpl.html GNU GPL v3 or later\n * @since 4.0\n *\n * @example Example of listening to a block event.<\/caption>\n * import {eventTypes as blockEventTypes} from 'core_block\/events';\n *\n * document.addEventListener(blockEventTypes.blockContentUpdated, e => {\n * window.console.log(e.target); \/\/ The HTMLElement relating to the block whose content was updated.\n * window.console.log(e.detail.instanceId); \/\/ The instanceId of the block that was updated.\n * });\n *\/\n\nimport {dispatchEvent} from 'core\/event_dispatcher';\n\n\/**\n * Events for `core_block`.\n *\n * @constant\n * @property {String} blockContentUpdated See {@link event:blockContentUpdated}\n *\/\nexport const eventTypes = {\n \/**\n * An event triggered when the content of a block has changed.\n *\n * @event blockContentUpdated\n * @type {CustomEvent}\n * @property {HTMLElement} target The block element that was updated\n * @property {object} detail\n * @property {number} detail.instanceId The block instance id\n *\/\n blockContentUpdated: 'core_block\/contentUpdated',\n};\n\n\/**\n * Trigger an event to indicate that the content of a block was updated.\n *\n * @method notifyBlockContentUpdated\n * @param {HTMLElement} element The HTMLElement containing the updated block.\n * @returns {CustomEvent}\n * @fires blockContentUpdated\n *\/\nexport const notifyBlockContentUpdated = element => dispatchEvent(\n eventTypes.blockContentUpdated,\n {\n instanceId: element.dataset.instanceId,\n },\n element\n);\n"],"names":["eventTypes","blockContentUpdated","element","instanceId","dataset"],"mappings":";;;;;;;;;;;;;;;;;MAuCaA,WAAa,CAUtBC,oBAAqB,+FAWgBC,UAAW,mCAChDF,WAAWC,oBACX,CACIE,WAAYD,QAAQE,QAAQD,YAEhCD"}