AutorÃa | Ultima modificación | Ver Log |
YUI.add('loader-rollup', function (Y, NAME) {/*** Optional automatic rollup logic for reducing http connections* when not using a combo service.* @module loader* @submodule rollup*//*** Look for rollup packages to determine if all of the modules a* rollup supersedes are required. If so, include the rollup to* help reduce the total number of connections required. Called* by calculate(). This is an optional feature, and requires the* appropriate submodule to function.* @method _rollup* @for Loader* @private*/Y.Loader.prototype._rollup = function() {var i, j, m, s, r = this.required, roll,info = this.moduleInfo, rolled, c, smod;// find and cache rollup modulesif (this.dirty || !this.rollups) {this.rollups = {};for (i in info) {if (info.hasOwnProperty(i)) {m = this.getModule(i);// if (m && m.rollup && m.supersedes) {if (m && m.rollup) {this.rollups[i] = m;}}}}// make as many passes as needed to pick up rollup rollupsfor (;;) {rolled = false;// go through the rollup candidatesfor (i in this.rollups) {if (this.rollups.hasOwnProperty(i)) {// there can be only one, unless forcedif (!r[i] && ((!this.loaded[i]) || this.forceMap[i])) {m = this.getModule(i);s = m.supersedes || [];roll = false;// @TODO remove continueif (!m.rollup) {continue;}c = 0;// check the thresholdfor (j = 0; j < s.length; j++) {smod = info[s[j]];// if the superseded module is loaded, we can't// load the rollup unless it has been forced.if (this.loaded[s[j]] && !this.forceMap[s[j]]) {roll = false;break;// increment the counter if this module is required.// if we are beyond the rollup threshold, we will// use the rollup module} else if (r[s[j]] && m.type === smod.type) {c++;// Y.log("adding to thresh: " + c + ", " + s[j]);roll = (c >= m.rollup);if (roll) {// Y.log("over thresh " + c + ", " + s[j]);break;}}}if (roll) {// Y.log("adding rollup: " + i);// add the rollupr[i] = true;rolled = true;// expand the rollup's dependenciesthis.getRequires(m);}}}}// if we made it here w/o rolling up something, we are doneif (!rolled) {break;}}};}, '3.18.1', {"requires": ["loader-base"]});