Skip to content

Commit

Permalink
Added preloading optimization
Browse files Browse the repository at this point in the history
  • Loading branch information
Raynos committed Nov 28, 2011
1 parent 2195f6b commit e8fa1c4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "trinity",
"version": "0.1.9",
"version": "0.1.10",
"author": "Jake Verbaten <raynos2@gmail.com>",
"main": "src/trinity",
"dependencies": {
Expand Down
8 changes: 7 additions & 1 deletion src/trinity.js
Expand Up @@ -196,6 +196,8 @@ var Trinity = {
var that = this,
modules = [];

if (this.preloaded[file]) return cb();

burrito(file, function (node) {
if (node.name === "call" &&
node.label() === "load"
Expand All @@ -210,7 +212,10 @@ var Trinity = {

function next(err) {
count--;
count === 0 && cb();
if (count === 0) {
that.preloaded[file] = true;
cb();
}
}

function recurseForJavaScript(err, file) {
Expand All @@ -232,6 +237,7 @@ var Trinity = {

next();
},
preloaded: [],
/*
readFile Utility
Expand Down

0 comments on commit e8fa1c4

Please sign in to comment.