Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Wrap requireAll in require for convenience

  • Loading branch information...
commit a5ec2197f2d0d98aef4cc30d405cce35015344d9 1 parent d70b8e3
Paul Chavard tchak authored

Showing 1 changed file with 11 additions and 3 deletions. Show diff stats Hide diff stats

  1. +11 3 lib/main.js
14 lib/main.js
@@ -18,7 +18,7 @@ if (typeof document !== "undefined") {
18 18 }
19 19 },
20 20
21   - require: function(name) {
  21 + requireModule: function(name) {
22 22 var loaded = minispade.loaded[name];
23 23 var mod = minispade.modules[name];
24 24
@@ -33,7 +33,7 @@ if (typeof document !== "undefined") {
33 33 }
34 34 } else {
35 35 if (minispade.root && name.substr(0,minispade.root.length) !== minispade.root) {
36   - return minispade.require(minispade.root+name);
  36 + return minispade.requireModule(minispade.root+name);
37 37 } else {
38 38 throw "The module '" + name + "' could not be found";
39 39 }
@@ -47,7 +47,15 @@ if (typeof document !== "undefined") {
47 47 for (var module in this.modules) {
48 48 if (!this.modules.hasOwnProperty(module)) { continue; }
49 49 if (regex && !regex.test(module)) { continue; }
50   - minispade.require(module);
  50 + minispade.requireModule(module);
  51 + }
  52 + },
  53 +
  54 + require: function(path) {
  55 + if (typeof path === 'string') {
  56 + minispade.requireModule(path);
  57 + } else {
  58 + minispade.requireAll(path);
51 59 }
52 60 },
53 61

0 comments on commit a5ec219

Please sign in to comment.
Something went wrong with that request. Please try again.