mirror of
https://github.com/moodle/moodle.git
synced 2025-01-17 21:49:15 +01:00
Merge branch 'MDL-68677-master' of git://github.com/andrewnicols/moodle
This commit is contained in:
commit
036b1beb49
2
lib/amd/build/prefetch.min.js
vendored
2
lib/amd/build/prefetch.min.js
vendored
@ -1,2 +1,2 @@
|
||||
define ("core/prefetch",["exports","core/config"],function(a,b){"use strict";Object.defineProperty(a,"__esModule",{value:!0});a.default=void 0;b=function(a){return a&&a.__esModule?a:{default:a}}(b);var i="undefined"!=typeof window?window:"undefined"!=typeof self?self:"undefined"!=typeof global?global:{};function c(a){return g(a)||f(a)||e(a)||d()}function d(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function e(a,b){if(!a)return;if("string"==typeof a)return h(a,b);var c=Object.prototype.toString.call(a).slice(8,-1);if("Object"===c&&a.constructor)c=a.constructor.name;if("Map"===c||"Set"===c)return Array.from(c);if("Arguments"===c||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(c))return h(a,b)}function f(a){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(a))return Array.from(a)}function g(a){if(Array.isArray(a))return h(a)}function h(a,b){if(null==b||b>a.length)b=a.length;for(var c=0,d=Array(b);c<b;c++){d[c]=a[c]}return d}var j=!1,k=[],l={},m,n=function(){if(k){var d=k.slice();k=[];("function"==typeof i.define&&i.define.amd?new Promise(function(a,b){i.require(["core/templates"],a,b)}):"undefined"!=typeof module&&module.exports&&"undefined"!=typeof require||"undefined"!=typeof module&&module.component&&i.require&&"component"===i.require.loader?Promise.resolve(require(("core/templates"))):Promise.resolve(i["core/templates"])).then(function(a){return a.prefetchTemplates(d)}).catch()}var a=l;l={};var b=[];Object.keys(a).forEach(function(d){b.push.apply(b,c(a[d].map(function(a){return{component:d,key:a}})))});("function"==typeof i.define&&i.define.amd?new Promise(function(a,b){i.require(["core/str"],a,b)}):"undefined"!=typeof module&&module.exports&&"undefined"!=typeof require||"undefined"!=typeof module&&module.component&&i.require&&"component"===i.require.loader?Promise.resolve(require(("core/str"))):Promise.resolve(i["core/str"])).then(function(a){return a.get_strings(b)}).catch()},o=function(){if(0>=b.default.jsrev){return}if(m){return}if(j){n();return}m=setTimeout(function(){j=!0;m=null;("function"==typeof i.define&&i.define.amd?new Promise(function(a,c){i.require([b.default.iconsystemmodule],a,c)}):"undefined"!=typeof module&&module.exports&&"undefined"!=typeof require||"undefined"!=typeof module&&module.component&&i.require&&"component"===i.require.loader?Promise.resolve(require((b.default.iconsystemmodule))):Promise.resolve(i[b.default.iconsystemmodule])).then(function(a){var b=new a;q(b.getTemplateName());return b}).then(function(a){n();a.init()}).catch()},500)},p=function(a){k=k.concat(a);o()},q=function(a){return p([a])},r=function(a,b){if(!l[a]){l[a]=[]}l[a]=l[a].concat(b);o()},s=function(a,b){if(!l[a]){l[a]=[]}l[a].push(b);o()};p([].concat(["core/loading"],["core/modal"],["core/modal_backdrop"]));r("core",["cancel","closebuttontitle","loading","savechanges"]);r("core_form",["showless","showmore"]);a.default={prefetchTemplate:q,prefetchTemplates:p,prefetchString:s,prefetchStrings:r};return a.default});
|
||||
define ("core/prefetch",["exports","core/config"],function(a,b){"use strict";Object.defineProperty(a,"__esModule",{value:!0});a.default=void 0;b=function(a){return a&&a.__esModule?a:{default:a}}(b);var i="undefined"!=typeof window?window:"undefined"!=typeof self?self:"undefined"!=typeof global?global:{};function c(a){return g(a)||f(a)||e(a)||d()}function d(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function e(a,b){if(!a)return;if("string"==typeof a)return h(a,b);var c=Object.prototype.toString.call(a).slice(8,-1);if("Object"===c&&a.constructor)c=a.constructor.name;if("Map"===c||"Set"===c)return Array.from(c);if("Arguments"===c||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(c))return h(a,b)}function f(a){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(a))return Array.from(a)}function g(a){if(Array.isArray(a))return h(a)}function h(a,b){if(null==b||b>a.length)b=a.length;for(var c=0,d=Array(b);c<b;c++){d[c]=a[c]}return d}var j=!1,k=[],l={},m,n=function(){if(k){var d=k.slice();k=[];("function"==typeof i.define&&i.define.amd?new Promise(function(a,b){i.require(["core/templates"],a,b)}):"undefined"!=typeof module&&module.exports&&"undefined"!=typeof require||"undefined"!=typeof module&&module.component&&i.require&&"component"===i.require.loader?Promise.resolve(require(("core/templates"))):Promise.resolve(i["core/templates"])).then(function(a){return a.prefetchTemplates(d)}).catch()}var a=l;l={};var b=[];Object.keys(a).forEach(function(d){b.push.apply(b,c(a[d].map(function(a){return{component:d,key:a}})))});("function"==typeof i.define&&i.define.amd?new Promise(function(a,b){i.require(["core/str"],a,b)}):"undefined"!=typeof module&&module.exports&&"undefined"!=typeof require||"undefined"!=typeof module&&module.component&&i.require&&"component"===i.require.loader?Promise.resolve(require(("core/str"))):Promise.resolve(i["core/str"])).then(function(a){return a.get_strings(b)}).catch()},o=function(){if(m){return}if(j){n();return}m=setTimeout(function(){j=!0;m=null;("function"==typeof i.define&&i.define.amd?new Promise(function(a,c){i.require([b.default.iconsystemmodule],a,c)}):"undefined"!=typeof module&&module.exports&&"undefined"!=typeof require||"undefined"!=typeof module&&module.component&&i.require&&"component"===i.require.loader?Promise.resolve(require((b.default.iconsystemmodule))):Promise.resolve(i[b.default.iconsystemmodule])).then(function(a){var b=new a;q(b.getTemplateName());return b}).then(function(a){n();a.init()}).catch()},500)},p=function(a){k=k.concat(a);o()},q=function(a){return p([a])},r=function(a,b){if(!l[a]){l[a]=[]}l[a]=l[a].concat(b);o()},s=function(a,b){if(!l[a]){l[a]=[]}l[a].push(b);o()};p([].concat(["core/loading"],["core/modal"],["core/modal_backdrop"]));r("core",["cancel","closebuttontitle","loading","savechanges"]);r("core_form",["showless","showmore"]);a.default={prefetchTemplate:q,prefetchTemplates:p,prefetchString:s,prefetchStrings:r};return a.default});
|
||||
//# sourceMappingURL=prefetch.min.js.map
|
||||
|
File diff suppressed because one or more lines are too long
2
lib/amd/build/templates.min.js
vendored
2
lib/amd/build/templates.min.js
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -75,11 +75,6 @@ const fetchQueue = () => {
|
||||
* Subsequent fetches are immediate.
|
||||
*/
|
||||
const processQueue = () => {
|
||||
if (Config.jsrev <= 0) {
|
||||
// No point pre-fetching when cachejs is disabled as we do not store anything in the cache anyway.
|
||||
return;
|
||||
}
|
||||
|
||||
if (prefetchTimer) {
|
||||
// There is a live prefetch timer. The initial prefetch has been scheduled but is not complete.
|
||||
return;
|
||||
|
@ -79,11 +79,6 @@ define([
|
||||
* @return {Object} jQuery promise resolved with the template source
|
||||
*/
|
||||
var getTemplatePromiseFromCache = function(searchKey) {
|
||||
// Do not cache anything if templaterev is not valid.
|
||||
if (M.cfg.templaterev <= 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// First try the cache of promises.
|
||||
if (searchKey in templatePromises) {
|
||||
return templatePromises[searchKey];
|
||||
@ -96,6 +91,11 @@ define([
|
||||
return templatePromises[searchKey];
|
||||
}
|
||||
|
||||
if (M.cfg.templaterev <= 0) {
|
||||
// Template caching is disabled. Do not store in persistent storage.
|
||||
return null;
|
||||
}
|
||||
|
||||
// Now try local storage.
|
||||
var cached = storage.get('core_template/' + M.cfg.templaterev + ':' + searchKey);
|
||||
if (cached) {
|
||||
@ -183,7 +183,11 @@ define([
|
||||
// Cache all of the dependent templates because we'll need them to render
|
||||
// the requested template.
|
||||
templateCache[tempSearchKey] = data.value;
|
||||
storage.set('core_template/' + M.cfg.templaterev + ':' + tempSearchKey, data.value);
|
||||
|
||||
if (M.cfg.templaterev > 0) {
|
||||
// The template cache is enabled - set the value there.
|
||||
storage.set('core_template/' + M.cfg.templaterev + ':' + tempSearchKey, data.value);
|
||||
}
|
||||
|
||||
if (data.component == component && data.name == name) {
|
||||
// This is the original template that was requested so remember it to return.
|
||||
|
@ -1390,9 +1390,7 @@ class page_requirements_manager {
|
||||
// First include must be to a module with no dependencies, this prevents multiple requests.
|
||||
$prefix = 'M.util.js_pending("core/first");';
|
||||
$prefix .= "require(['core/first'], function() {\n";
|
||||
if ($cachejs) {
|
||||
$prefix .= "require(['core/prefetch']);\n";
|
||||
}
|
||||
$prefix .= "require(['core/prefetch']);\n";
|
||||
$suffix = 'M.util.js_complete("core/first");';
|
||||
$suffix .= "\n});";
|
||||
$output .= html_writer::script($prefix . implode(";\n", $this->amdjscode) . $suffix);
|
||||
|
Loading…
x
Reference in New Issue
Block a user