mirror of
https://github.com/discourse/discourse.git
synced 2024-11-26 12:53:42 +08:00
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,
|
||||
|
|
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 New Issue
Block a user