FEATURE: hasModule global helper to figure out if module exists
This commit is contained in:
parent
43c3e6b47f
commit
2aec93c13d
|
@ -49,6 +49,7 @@
|
|||
"notEqual",
|
||||
"require",
|
||||
"requirejs",
|
||||
"hasModule",
|
||||
"Blob",
|
||||
"File"],
|
||||
"node" : false,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
var define, requireModule, require, requirejs;
|
||||
var define, requireModule, require, requirejs, hasModule;
|
||||
|
||||
(function() {
|
||||
var registry = {}, seen = {}, state = {};
|
||||
|
@ -32,6 +32,10 @@ var define, requireModule, require, requirejs;
|
|||
};
|
||||
}
|
||||
|
||||
hasModule = function(name){
|
||||
return !!registry[name];
|
||||
};
|
||||
|
||||
requirejs = require = requireModule = function(name) {
|
||||
if (state[name] !== FAILED &&
|
||||
seen.hasOwnProperty(name)) {
|
||||
|
|
Loading…
Reference in New Issue