{"version":3,"file":"modal_registry.min.js","sources":["http:\/\/www.eb23caiderei.pt\/moodle\/lib\/amd\/src\/modal_registry.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 .\n\n\/**\n * A registry for the different types of modal.\n *\n * @module core\/modal_registry\n * @class modal_registry\n * @copyright 2016 Ryan Wyllie \n * @license http:\/\/www.gnu.org\/copyleft\/gpl.html GNU GPL v3 or later\n *\/\ndefine(['core\/notification', 'core\/prefetch'], function(Notification, Prefetch) {\n\n \/\/ A singleton registry for all modules to access. Allows types to be\n \/\/ added at runtime.\n var registry = {};\n\n \/**\n * Get a registered type of modal.\n *\n * @method get\n * @param {string} type The type of modal to get\n * @return {object} The registered config for the modal\n *\/\n var get = function(type) {\n return registry[type];\n };\n\n \/**\n * Register a modal with the registry.\n *\n * @method register\n * @param {string} type The type of modal (must be unique)\n * @param {function} module The modal module (must be a constructor function of type core\/modal)\n * @param {string} template The template name of the modal\n *\/\n var register = function(type, module, template) {\n if (get(type)) {\n Notification.exception({message: \"Modal of type '\" + type + \"' is already registered\"});\n }\n\n if (!module || typeof module !== 'function') {\n Notification.exception({message: \"You must provide a modal module\"});\n }\n\n if (!template) {\n Notification.exception({message: \"You must provide a modal template\"});\n }\n\n registry[type] = {\n module: module,\n template: template,\n };\n\n \/\/ Prefetch the template.\n Prefetch.prefetchTemplate(template);\n };\n\n return {\n register: register,\n get: get,\n };\n});\n"],"names":["define","Notification","Prefetch","registry","get","type","register","module","template","exception","message","prefetchTemplate"],"mappings":";;;;;;;;AAuBAA,6BAAO,CAAC,oBAAqB,kBAAkB,SAASC,aAAcC,cAI9DC,SAAW,GASXC,IAAM,SAASC,aACRF,SAASE,aAiCb,CACHC,SAvBW,SAASD,KAAME,OAAQC,UAC9BJ,IAAIC,OACJJ,aAAaQ,UAAU,CAACC,QAAS,mBAAqBL,KAAO,4BAG5DE,QAA4B,mBAAXA,QAClBN,aAAaQ,UAAU,CAACC,QAAS,oCAGhCF,UACDP,aAAaQ,UAAU,CAACC,QAAS,sCAGrCP,SAASE,MAAQ,CACbE,OAAQA,OACRC,SAAUA,UAIdN,SAASS,iBAAiBH,WAK1BJ,IAAKA"}