mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-27 09:36:19 -05:00
FEATURE: hasModule global helper to figure out if module exists
This commit is contained in:
parent
43c3e6b47f
commit
2aec93c13d
2 changed files with 6 additions and 1 deletions
|
@ -49,6 +49,7 @@
|
|||
"notEqual",
|
||||
"require",
|
||||
"requirejs",
|
||||
"hasModule",
|
||||
"Blob",
|
||||
"File"],
|
||||
"node" : false,
|
||||
|
|
6
vendor/assets/javascripts/loader.js
vendored
6
vendor/assets/javascripts/loader.js
vendored
|
@ -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 a new issue