mirror of
https://github.com/moodle/moodle.git
synced 2025-04-22 00:42:54 +02:00
MDL-68524 core: Prefetch modal registry templates
This commit is contained in:
parent
983baf4e34
commit
a427a48c10
2
lib/amd/build/modal_registry.min.js
vendored
2
lib/amd/build/modal_registry.min.js
vendored
@ -1,2 +1,2 @@
|
||||
define ("core/modal_registry",["core/notification"],function(a){var b={},c=function(a){return b[a]};return{register:function register(d,e,f){if(c(d)){a.exception({message:"Modal of type '"+d+"' is already registered"})}if(!e||"function"!=typeof e){a.exception({message:"You must provide a modal module"})}if(!f){a.exception({message:"You must provide a modal template"})}b[d]={module:e,template:f}},get:c}});
|
||||
define ("core/modal_registry",["core/notification","core/prefetch"],function(a,b){var c={},d=function(a){return c[a]};return{register:function register(e,f,g){if(d(e)){a.exception({message:"Modal of type '"+e+"' is already registered"})}if(!f||"function"!=typeof f){a.exception({message:"You must provide a modal module"})}if(!g){a.exception({message:"You must provide a modal template"})}c[e]={module:f,template:g};b.prefetchTemplate(g)},get:d}});
|
||||
//# sourceMappingURL=modal_registry.min.js.map
|
||||
|
@ -1 +1 @@
|
||||
{"version":3,"sources":["../src/modal_registry.js"],"names":["define","Notification","registry","get","type","register","module","template","exception","message"],"mappings":"AAwBAA,OAAM,uBAAC,CAAC,mBAAD,CAAD,CAAwB,SAASC,CAAT,CAAuB,IAI7CC,CAAAA,CAAQ,CAAG,EAJkC,CAa7CC,CAAG,CAAG,SAASC,CAAT,CAAe,CACrB,MAAOF,CAAAA,CAAQ,CAACE,CAAD,CAClB,CAfgD,CA4CjD,MAAO,CACHC,QAAQ,CApBG,QAAXA,CAAAA,QAAW,CAASD,CAAT,CAAeE,CAAf,CAAuBC,CAAvB,CAAiC,CAC5C,GAAIJ,CAAG,CAACC,CAAD,CAAP,CAAe,CACXH,CAAY,CAACO,SAAb,CAAuB,CAACC,OAAO,CAAE,mBAAqBL,CAArB,CAA4B,yBAAtC,CAAvB,CACH,CAED,GAAI,CAACE,CAAD,EAA6B,UAAlB,QAAOA,CAAAA,CAAtB,CAA6C,CACzCL,CAAY,CAACO,SAAb,CAAuB,CAACC,OAAO,CAAE,iCAAV,CAAvB,CACH,CAED,GAAI,CAACF,CAAL,CAAe,CACXN,CAAY,CAACO,SAAb,CAAuB,CAACC,OAAO,CAAE,mCAAV,CAAvB,CACH,CAEDP,CAAQ,CAACE,CAAD,CAAR,CAAiB,CACbE,MAAM,CAAEA,CADK,CAEbC,QAAQ,CAAEA,CAFG,CAIpB,CAEM,CAEHJ,GAAG,CAAEA,CAFF,CAIV,CAhDK,CAAN","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 * A registry for the different types of modal.\n *\n * @module core/modal_registry\n * @class modal_registry\n * @package core\n * @copyright 2016 Ryan Wyllie <ryan@moodle.com>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\ndefine(['core/notification'], function(Notification) {\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\n return {\n register: register,\n get: get,\n };\n});\n"],"file":"modal_registry.min.js"}
|
||||
{"version":3,"sources":["../src/modal_registry.js"],"names":["define","Notification","Prefetch","registry","get","type","register","module","template","exception","message","prefetchTemplate"],"mappings":"AAwBAA,OAAM,uBAAC,CAAC,mBAAD,CAAsB,eAAtB,CAAD,CAAyC,SAASC,CAAT,CAAuBC,CAAvB,CAAiC,IAIxEC,CAAAA,CAAQ,CAAG,EAJ6D,CAaxEC,CAAG,CAAG,SAASC,CAAT,CAAe,CACrB,MAAOF,CAAAA,CAAQ,CAACE,CAAD,CAClB,CAf2E,CA+C5E,MAAO,CACHC,QAAQ,CAvBG,QAAXA,CAAAA,QAAW,CAASD,CAAT,CAAeE,CAAf,CAAuBC,CAAvB,CAAiC,CAC5C,GAAIJ,CAAG,CAACC,CAAD,CAAP,CAAe,CACXJ,CAAY,CAACQ,SAAb,CAAuB,CAACC,OAAO,CAAE,mBAAqBL,CAArB,CAA4B,yBAAtC,CAAvB,CACH,CAED,GAAI,CAACE,CAAD,EAA6B,UAAlB,QAAOA,CAAAA,CAAtB,CAA6C,CACzCN,CAAY,CAACQ,SAAb,CAAuB,CAACC,OAAO,CAAE,iCAAV,CAAvB,CACH,CAED,GAAI,CAACF,CAAL,CAAe,CACXP,CAAY,CAACQ,SAAb,CAAuB,CAACC,OAAO,CAAE,mCAAV,CAAvB,CACH,CAEDP,CAAQ,CAACE,CAAD,CAAR,CAAiB,CACbE,MAAM,CAAEA,CADK,CAEbC,QAAQ,CAAEA,CAFG,CAAjB,CAMAN,CAAQ,CAACS,gBAAT,CAA0BH,CAA1B,CACH,CAEM,CAEHJ,GAAG,CAAEA,CAFF,CAIV,CAnDK,CAAN","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 * A registry for the different types of modal.\n *\n * @module core/modal_registry\n * @class modal_registry\n * @package core\n * @copyright 2016 Ryan Wyllie <ryan@moodle.com>\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"],"file":"modal_registry.min.js"}
|
@ -22,7 +22,7 @@
|
||||
* @copyright 2016 Ryan Wyllie <ryan@moodle.com>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
define(['core/notification'], function(Notification) {
|
||||
define(['core/notification', 'core/prefetch'], function(Notification, Prefetch) {
|
||||
|
||||
// A singleton registry for all modules to access. Allows types to be
|
||||
// added at runtime.
|
||||
@ -64,6 +64,9 @@ define(['core/notification'], function(Notification) {
|
||||
module: module,
|
||||
template: template,
|
||||
};
|
||||
|
||||
// Prefetch the template.
|
||||
Prefetch.prefetchTemplate(template);
|
||||
};
|
||||
|
||||
return {
|
||||
|
Loading…
x
Reference in New Issue
Block a user