diff options
| author | Rob Spies | 2010-07-13 14:09:53 -0700 |
|---|---|---|
| committer | Rob Spies | 2010-07-13 14:09:53 -0700 |
| commit | 4034a2d1e2efb6c76020273c96c3da5ae146f5ca (patch) | |
| tree | 529e6660bab9237aca3218e67902f1eea44bd260 /src | |
| parent | 8f9bf37bcf38165e89f37c147f9315cb8e72fc1f (diff) | |
| download | angular.js-4034a2d1e2efb6c76020273c96c3da5ae146f5ca.tar.bz2 | |
better naming for our verify cache scheme, and tests.
Diffstat (limited to 'src')
| -rw-r--r-- | src/Resource.js | 9 | ||||
| -rw-r--r-- | src/services.js | 4 |
2 files changed, 7 insertions, 6 deletions
diff --git a/src/Resource.js b/src/Resource.js index ba460c30..1279dc54 100644 --- a/src/Resource.js +++ b/src/Resource.js @@ -1,3 +1,5 @@ + + function Route(template, defaults) { this.template = template = template + '#'; this.defaults = defaults || {}; @@ -86,7 +88,7 @@ ResourceFactory.prototype = { throw "Expected between 0-3 arguments [params, data, callback], got " + arguments.length + " arguments."; } - var value = action.isArray ? [] : new Resource(data;) + var value = action.isArray ? [] : new Resource(data) self.xhr( action.method, route.url(extend({}, action.params || {}, extractParams(data), params)), @@ -94,8 +96,7 @@ ResourceFactory.prototype = { function(status, response, clear) { if (status == 200) { if (action.isArray) { - if (action.cacheThenRetrieve) - value = []; + value.length = 0; foreach(response, function(item){ value.push(new Resource(item)); }); @@ -107,7 +108,7 @@ ResourceFactory.prototype = { throw {status: status, response:response, message: status + ": " + response}; } }, - action.cacheThenRetrieve + action.verifyCache ); return value; }; diff --git a/src/services.js b/src/services.js index 64f2ea4f..ed6f73ad 100644 --- a/src/services.js +++ b/src/services.js @@ -313,7 +313,7 @@ angularService('$xhr.bulk', function($xhr, $error, $log){ angularService('$xhr.cache', function($xhr){ var inflight = {}, self = this;; - function cache(method, url, post, callback, cacheThenRetrieve){ + function cache(method, url, post, callback, verifyCache){ if (isFunction(post)) { callback = post; post = null; @@ -322,7 +322,7 @@ angularService('$xhr.cache', function($xhr){ var data; if (data = cache.data[url]) { callback(200, copy(data.value)); - if (!cacheThenRetrieve) + if (!verifyCache) return; } |
