2 YUI 3.13.0 (build 508226d)
3 Copyright 2013 Yahoo! Inc. All rights reserved.
4 Licensed under the BSD License.
5 http://yuilibrary.com/license/
8 YUI.add('loader-rollup', function (Y, NAME) {
11 * Optional automatic rollup logic for reducing http connections
12 * when not using a combo service.
18 * Look for rollup packages to determine if all of the modules a
19 * rollup supersedes are required. If so, include the rollup to
20 * help reduce the total number of connections required. Called
21 * by calculate(). This is an optional feature, and requires the
22 * appropriate submodule to function.
27 Y.Loader.prototype._rollup = function() {
28 var i, j, m, s, r = this.required, roll,
29 info = this.moduleInfo, rolled, c, smod;
31 // find and cache rollup modules
32 if (this.dirty || !this.rollups) {
35 if (info.hasOwnProperty(i)) {
36 m = this.getModule(i);
37 // if (m && m.rollup && m.supersedes) {
45 // make as many passes as needed to pick up rollup rollups
49 // go through the rollup candidates
50 for (i in this.rollups) {
51 if (this.rollups.hasOwnProperty(i)) {
52 // there can be only one, unless forced
53 if (!r[i] && ((!this.loaded[i]) || this.forceMap[i])) {
54 m = this.getModule(i);
55 s = m.supersedes || [];
58 // @TODO remove continue
65 // check the threshold
66 for (j = 0; j < s.length; j++) {
69 // if the superseded module is loaded, we can't
70 // load the rollup unless it has been forced.
71 if (this.loaded[s[j]] && !this.forceMap[s[j]]) {
74 // increment the counter if this module is required.
75 // if we are beyond the rollup threshold, we will
76 // use the rollup module
77 } else if (r[s[j]] && m.type === smod.type) {
79 // Y.log("adding to thresh: " + c + ", " + s[j]);
80 roll = (c >= m.rollup);
82 // Y.log("over thresh " + c + ", " + s[j]);
89 // Y.log("adding rollup: " + i);
94 // expand the rollup's dependencies
101 // if we made it here w/o rolling up something, we are done
109 }, '3.13.0', {"requires": ["loader-base"]});