Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Speed up dependency loader and update comment

  • Loading branch information...
commit b70ef31980555f4b59b9af8f5e91be87d86cce81 1 parent 3aaa6d7
@creationix authored
Showing with 6 additions and 9 deletions.
  1. +4 −4 autoloader.js
  2. +2 −5 autoloader/bootstrap.js
View
8 autoloader.js
@@ -21,7 +21,7 @@ module.exports = function setup(mount, folder, uglify) {
return function handle(req, res, next) {
if (!req.uri) { req.uri = Url.parse(req.url); }
if (req.uri.pathname !== mount) return next();
- var names = req.uri.query.split(",");
+ var names = req.uri.query.split(",").reverse();
var has = {};
var scripts = [];
@@ -38,11 +38,11 @@ module.exports = function setup(mount, folder, uglify) {
if (matches) {
matches = Array.prototype.slice.call(matches).map(function (dep) {
return dep.match(findName)[1];
- });
+ }).reverse();
function getDep(err) {
if (err) return next(err);
- var dep = matches.shift();
+ var dep = matches.pop();
if (!dep) return doneDeps();
loadScript(dep, getDep);
}
@@ -64,7 +64,7 @@ module.exports = function setup(mount, folder, uglify) {
function getName(err) {
if (err) return next(err);
- var name = names.shift();
+ var name = names.pop();
if (!name) return done();
loadScript(name, getName);
}
View
7 autoloader/bootstrap.js
@@ -1,8 +1,5 @@
-// This is a super simple module system for use in the browser. You first
-// define your module using the "define" function and then later require it
-// using "require" This does not support circular dependencies or require search
-// paths. It's a simple module repository for writing clean code.
-
+// Super simple require system to go along with the server-side help in the
+// autoloader middleware for "creationix".
(function () {
// Store our repository in private variables in this closure.
Please sign in to comment.
Something went wrong with that request. Please try again.