Closed thany closed 9 years ago
Temporary workaround is to use storageImpl
, like so:
app.factory("JsonCache", ["DSCacheFactory", function jsonCacheFactory(DSCacheFactory) {
var cacheImpl = {
setItem: function(key, value) {
window.sessionStorage.setItem(key, value);
},
getItem: function(key) {
return window.sessionStorage.getItem(key);
},
removeItem: function(key) {
window.sessionStorage.removeItem(key);
}
};
return DSCacheFactory("json-cache", {
// more config
storageMode: window.sessionStorage ? "sessionStorage" : "memory",
storageImpl: window.sessionStorage ? cacheImpl : undefined
});
}]);
This seems to work fine. Although I'd expect storageMode: "sessionStorage"
to work as well, so this is not quite a fix. But good to know that it can work.
I think I found the issue. See #122
Ah, makes sense. That is why my workaround works :)
When I use a cache that has
storageMode
set to either"localStorage"
or"sessionStorage"
, I get this error whenever I (a$resource
) is trying to use it:In angular-1.3.2.js on line 279.
Full stack:
The version numbers are right there. Browser in question is Firefox 33.