MCPcopy
hub / github.com/moxiecode/plupload / newContext

Function newContext

tests/js/require.js:199–1745  ·  view source on GitHub ↗
(contextName)

Source from the content-addressed store, hash-verified

197 }
198
199 function newContext(contextName) {
200 var inCheckLoaded, Module, context, handlers,
201 checkLoadedTimeoutId,
202 config = {
203 //Defaults. Do not set a default for map
204 //config to speed up normalize(), which
205 //will run faster if there is no default.
206 waitSeconds: 7,
207 baseUrl: './',
208 paths: {},
209 bundles: {},
210 pkgs: {},
211 shim: {},
212 config: {}
213 },
214 registry = {},
215 //registry of just enabled modules, to speed
216 //cycle breaking code when lots of modules
217 //are registered, but not activated.
218 enabledRegistry = {},
219 undefEvents = {},
220 defQueue = [],
221 defined = {},
222 urlFetched = {},
223 bundlesMap = {},
224 requireCounter = 1,
225 unnormalizedCounter = 1;
226
227 /**
228 * Trims the . and .. from an array of path segments.
229 * It will keep a leading path segment if a .. will become
230 * the first path segment, to help with module name lookups,
231 * which act like paths, but can be remapped. But the end result,
232 * all paths that use this function should look normalized.
233 * NOTE: this method MODIFIES the input array.
234 * @param {Array} ary the array of path segments.
235 */
236 function trimDots(ary) {
237 var i, part;
238 for (i = 0; i < ary.length; i++) {
239 part = ary[i];
240 if (part === '.') {
241 ary.splice(i, 1);
242 i -= 1;
243 } else if (part === '..') {
244 // If at the start, or previous value is still ..,
245 // keep them so that when converted to a path it may
246 // still work when converted to a path, even though
247 // as an ID it is less than ideal. In larger point
248 // releases, may be better to just kick out an error.
249 if (i === 0 || (i === 1 && ary[2] === '..') || ary[i - 1] === '..') {
250 continue;
251 } else if (i > 0) {
252 ary.splice(i - 1, 2);
253 i -= 2;
254 }
255 }
256 }

Callers

nothing calls this directly

Calls 15

getOwnFunction · 0.85
bindFunction · 0.85
hasPropFunction · 0.85
isFunctionFunction · 0.85
cleanRegistryFunction · 0.85
makeModuleMapFunction · 0.85
onFunction · 0.85
normalizeFunction · 0.85
eachPropFunction · 0.85
getModuleFunction · 0.85
makeErrorFunction · 0.85
localRequireFunction · 0.85

Tested by

no test coverage detected