Skip to content

Commit

Permalink
Merge pull request monsur#6 from OleksandrBerezianskyi/master
Browse files Browse the repository at this point in the history
Changed calls from 'localStorage' to 'window.localStorage' to support google closures obfuscator
  • Loading branch information
monsur committed Mar 12, 2012
2 parents 4151f80 + bac30cc commit c003cd6
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions cache.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,24 +106,24 @@ Cache.LocalStorageCacheStorage = function(namespace) {
this.regexp_ = new RegExp('^' + escapedPrefix)
}
Cache.LocalStorageCacheStorage.prototype.get = function(key) {
var item = localStorage[this.prefix_ + key];
var item = window.localStorage[this.prefix_ + key];
if (item) return JSON.parse(item);
return null;
}
Cache.LocalStorageCacheStorage.prototype.set = function(key, value) {
localStorage[this.prefix_ + key] = JSON.stringify(value);
window.localStorage[this.prefix_ + key] = JSON.stringify(value);
}
Cache.LocalStorageCacheStorage.prototype.size = function(key, value) {
return this.keys().length;
}
Cache.LocalStorageCacheStorage.prototype.remove = function(key) {
var item = this.get(key);
delete localStorage[this.prefix_ + key];
delete window.localStorage[this.prefix_ + key];
return item;
}
Cache.LocalStorageCacheStorage.prototype.keys = function() {
var ret = [], p;
for (p in localStorage) {
for (p in window.localStorage) {
if (p.match(this.regexp_)) ret.push(p.replace(this.prefix_, ''));
};
return ret;
Expand Down

0 comments on commit c003cd6

Please sign in to comment.