rls.js revision b06f0506728aa781ea59ef35737b6e965463c7af
/**
* RLS (Remote Loader Service) Support
* @module yui
* @submodule rls
* @class rls
*/
Y.rls_handleTimeout = function(o) {
o.purge();
o.message = 'RLS request timed out, fetching loader';
Y.rls_failure(o);
};
Y.rls_handleFailure = function(o) {
o.message = 'RLS request failed, fetching loader';
Y.rls_failure(o);
};
Y.rls_failure = function(o) {
if (o.data) {
//Call the RLS done method, so it can progress the queue
Y.rls_advance();
});
}
};
/**
* Checks the environment for local modules and deals with them before firing off an RLS request.
* This needs to make sure that all dependencies are calculated before it can make an RLS request in
* order to make sure all remote dependencies are evaluated and their requirements are met.
* @method rls_locals
* @private
* @param {YUI} instance The YUI Instance we are working with.
* @param {Array} argz The requested modules.
* @param {Callback} cb The callback to be executed when we are done
* @param {YUI} cb.instance The instance is passed back to the callback
* @param {Array} cb.argz The modified list or modules needed to require
*/
var data = {
message: 'RLS is disabled, moving to loader',
};
Y.rls_failure(data);
return;
}
PATH = 'fullpath', f,
for (f in mods) {
if (asked[f]) {
if (mods[f]) {
}
}
}
});
}
}
}
}
onEnd: function(o) {
},
});
} else {
}
} else {
}
};
/**
* Check the environment and the local config to determine if a module has already been registered.
* @method rls_needs
* @private
* @param {String} mod The module to check
* @param {YUI} instance The instance to check against.
*/
return true;
}
return false;
};
/**
* Implentation for building the remote loader service url.
* @method _rls
* @private
* @param {Array} what the requested modules.
* @since 3.2.0
* @return {string} the url for the remote loader service call, returns false if no modules are required to be fetched (they are in the ENV already).
*/
YArray = Y.Array,
YObject = Y.Object,
// the configuration
m: 1, // required in the template
v: Y.version,
},
// The rls base path
// the template
var s = [], param;
}
}
// console.log('rls_tmpl: ' + s);
return s.join('&');
}(),
w = [],
url;
for (i = 0; i < len; i++) {
if (a) {
for (j = 0; j < a.length; j++) {
w.push(a[j]);
}
} else {
}
}
what = w;
for (i = 0; i < len; i++) {
Y.log('Did not find ' + what[i] + ' in YUI.Env.mods or config.modules adding to RLS', 'info', 'rls');
} else {
}
}
if (mods) {
for (i in mods) {
for (o = 0; o < len; o++) {
} else {
if (d) {
d = d.details || d;
if (!d.noop) {
if (d.requires) {
if (Y.rls_needs(o)) {
m.push(o);
}
});
}
}
}
}
}
}
}
}
if (!i.noop) {
if (Y.rls_needs(o)) {
m.push(o);
}
});
}
}
}
});
//Add in the debug modules
}
//If they have a groups config, add the loader-base module
m.unshift('loader-base');
}
//Strip Duplicates
if (!m.length) {
//Return here if there no modules to load.
return false;
}
// update the request
YUI._rls_active = {
attach: m,
inst: Y,
};
return url;
};
/**
*
* @method rls_oncomplete
* @param {Callback} cb The callback to execute when the RLS request is complete
*/
Y.rls_oncomplete = function(cb) {
};
Y.rls_advance = function() {
G_ENV._rls_in_progress = false;
}
};
/**
* Calls the callback registered with Y.rls_oncomplete when the RLS request (and it's dependency requests) is done.
* @method rls_done
* @param {Array} data The modules loaded
*/
};
/**
* Hash to hang on to the calling RLS instance so we can deal with the return from the server.
* @property _rls_active
* @private
* @type Object
* @static
*/
if (!YUI._rls_active) {
YUI._rls_active = {};
}
/**
* An array of skins loaded via RLS to populate the ENV with when making future requests.
* @property _rls_skins
* @private
* @type Array
* @static
*/
if (!YUI._rls_skins) {
YUI._rls_skins = [];
}
/**
*
* @method $rls
* @private
* @static
* @param {Object} req The data returned from the RLS server
* @param {String} req.css Does this request need CSS? If so, load the same RLS url with &css=1 attached
* @param {Array} req.module The sorted list of modules to attach to the page.
*/
Y = rls_active.inst;
if (Y) {
Y.rls_failure({
});
}
return;
}
}
});
if (loadInt) {
}
}
Y.Env.bootstrapped = true;
}
});
if (!additional) {
additional = [];
}
}
if (additional && Y.Loader) {
loader.ignoreRegistered = false;
} else {
}
}
}
};
}