MCPcopy Create free account
hub / github.com/cujojs/poly / _define

Function _define

test/curl.js:974–1007  ·  view source on GitHub ↗
(args)

Source from the content-addressed store, hash-verified

972 }
973
974 function _define (args) {
975
976 var id = args.id;
977
978 if (id == undef) {
979 if (argsNet !== undef) {
980 argsNet = {ex: 'Multiple anonymous defines in url'};
981 }
982 else if (!(id = core.getCurrentDefName())/* intentional assignment */) {
983 // anonymous define(), defer processing until after script loads
984 argsNet = args;
985 }
986 }
987 if (id != undef) {
988 // named define(), it is in the cache if we are loading a dependency
989 // (could also be a secondary define() appearing in a built file, etc.)
990 var def = cache[id];
991 if (!(id in cache)) {
992 // id is an absolute id in this case, so we can get the config.
993 // there's no way to allow a named define to fetch dependencies
994 // in the preload phase since we can't cascade the parent def.
995 var cfg = core.resolvePathInfo(id, userCfg).config;
996 def = cache[id] = core.createResourceDef(cfg, id);
997 }
998 // check if this resource has already been resolved (can happen if
999 // a module was defined inside a built file and outside of it and
1000 // dev didn't coordinate it explicitly)
1001 if (isPromise(def)) {
1002 def.useNet = false;
1003 core.defineResource(def, args);
1004 }
1005 }
1006
1007 }
1008
1009 /***** grab any global configuration info *****/
1010

Callers 1

curl.jsFile · 0.85

Calls 1

isPromiseFunction · 0.85

Tested by

no test coverage detected