Skip to content
This repository has been archived by the owner on Mar 13, 2018. It is now read-only.

Commit

Permalink
re-expose loader cache
Browse files Browse the repository at this point in the history
  • Loading branch information
sorvell committed Jan 21, 2014
1 parent 3f4ca5c commit 389e8b0
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/Loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,8 @@
var path = scope.path;
var xhr = scope.xhr;

var cache = {};

var Loader = function(onLoad, onComplete) {
this.cache = {};
this.onload = onLoad;
this.oncomplete = onComplete;
this.inflight = 0;
Expand Down Expand Up @@ -49,7 +48,7 @@
}
if (this.cache[url]) {
// complete load using cache data
this.onload(url, elt, cache[url]);
this.onload(url, elt, this.cache[url]);
// finished this transaction
this.tail();
// don't need fetch
Expand Down Expand Up @@ -81,7 +80,7 @@
},
receive: function(url, elt, err, resource) {
if (!err) {
cache[url] = resource;
this.cache[url] = resource;
}
this.pending[url].forEach(function(e) {
if (!err) {
Expand Down

0 comments on commit 389e8b0

Please sign in to comment.