Skip to content

Commit 66115c7

Browse files
committed
localStorage reset when full.
1 parent 958b904 commit 66115c7

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/geography.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,13 @@ THREE.ARMapzenGeography = function(opts){
107107
return response.json();
108108
}).then(function(data){
109109
callback(data);
110-
localStorage['mz_' + key] = JSON.stringify(data);
110+
try {
111+
localStorage['mz_' + key] = JSON.stringify(data);
112+
} catch(e) {
113+
if(e.toString().indexOf('QuotaExceededError') > -1) {
114+
localStorage.clear();
115+
}
116+
}
111117
});
112118
}
113119
};

0 commit comments

Comments
 (0)