diff --git a/lib/amd/build/modal_registry.min.js b/lib/amd/build/modal_registry.min.js index b01e07b616b..05cda333729 100644 --- a/lib/amd/build/modal_registry.min.js +++ b/lib/amd/build/modal_registry.min.js @@ -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 diff --git a/lib/amd/build/modal_registry.min.js.map b/lib/amd/build/modal_registry.min.js.map index baa89bb6090..04a952b1096 100644 --- a/lib/amd/build/modal_registry.min.js.map +++ b/lib/amd/build/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 .\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 \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"} \ No newline at end of file +{"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 .\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 \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"} \ No newline at end of file diff --git a/lib/amd/src/modal_registry.js b/lib/amd/src/modal_registry.js index 164af17772c..fc7bdbc708c 100644 --- a/lib/amd/src/modal_registry.js +++ b/lib/amd/src/modal_registry.js @@ -22,7 +22,7 @@ * @copyright 2016 Ryan Wyllie * @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 {