function ResourceManager(options) { var t = this; // exports t.fetchResources = fetchResources; // locals var resources = []; var cache = []; _addResourceSources(options.resources); /** * ---------------------------------------------------------------- * Categorize and add the provided sources * ---------------------------------------------------------------- */ function _addResourceSources(sources) { var resource = {}; if ($.isFunction(sources)) { // is it a function? resource = { resources: sources }; resources.push(resource); } else if (typeof sources == 'string') { // is it a URL string? resource = { url: sources }; resources.push(resource); } else if (typeof sources == 'object') { // is it json object? for (var i=0; i