Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #1 from wagenet/patch-1

Support for setting a root for requires.
  • Loading branch information...
commit e660d0ea33ab7ae27553ec918029460ec41ad68b 2 parents 060dcc9 + 721357d
@wycats wycats authored
Showing with 8 additions and 3 deletions.
  1. +8 −3 lib/main.js
View
11 lib/main.js
@@ -1,6 +1,7 @@
if (typeof document !== "undefined") {
(function() {
minispade = {
+ root: null,
modules: {},
loaded: {},
@@ -10,10 +11,14 @@ if (typeof document !== "undefined") {
if (!loaded) {
if (mod) {
- loaded = mod();
+ loaded = mod() || true;
minispade.loaded[name] = loaded;
} else {
- throw "The module '" + name + "' could not be found";
+ if (minispade.root && name.substr(0,minispade.root.length) !== minispade.root) {
+ return minispade.require(minispade.root+name);
+ } else {
+ throw "The module '" + name + "' could not be found";
+ }
}
}
@@ -35,4 +40,4 @@ if (typeof document !== "undefined") {
}
});
})();
-}
+}
Please sign in to comment.
Something went wrong with that request. Please try again.