mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-23 15:48:43 -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",
|
"notEqual",
|
||||||
"require",
|
"require",
|
||||||
"requirejs",
|
"requirejs",
|
||||||
|
"hasModule",
|
||||||
"Blob",
|
"Blob",
|
||||||
"File"],
|
"File"],
|
||||||
"node" : false,
|
"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() {
|
(function() {
|
||||||
var registry = {}, seen = {}, state = {};
|
var registry = {}, seen = {}, state = {};
|
||||||
|
@ -32,6 +32,10 @@ var define, requireModule, require, requirejs;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
hasModule = function(name){
|
||||||
|
return !!registry[name];
|
||||||
|
};
|
||||||
|
|
||||||
requirejs = require = requireModule = function(name) {
|
requirejs = require = requireModule = function(name) {
|
||||||
if (state[name] !== FAILED &&
|
if (state[name] !== FAILED &&
|
||||||
seen.hasOwnProperty(name)) {
|
seen.hasOwnProperty(name)) {
|
||||||
|
|
Loading…
Reference in a new issue