Download:
child 47:3c07b5faed13
parent 45:8e83e81fdad9
46:14d6c0a48023
Anton Shestakov <engored@ya.ru>, Sun, 05 Apr 2015 03:44:40 +0800
Catch and work around exceptions when localStorage is not available

1 файлов изменено, 11 вставок(+), 4 удалений(-) [+]
static/js/framework/collections.js file | annotate | diff | comparison | revisions
--- a/static/js/framework/collections.js Sun Apr 05 02:51:05 2015 +0800
+++ b/static/js/framework/collections.js Sun Apr 05 03:44:40 2015 +0800
@@ -1,7 +1,14 @@
-var Workspaces = Backbone.Collection.extend({
- localStorage: new Backbone.LocalStorage('workspaces'),
- model: Workspace
-});
+try {
+ var workspacesExtra = {
+ localStorage: new Backbone.LocalStorage('workspaces')
+ };
+} catch (e) {
+ var workspacesExtra = {
+ fetch: function() {},
+ create: function() {}
+ };
+}
+var Workspaces = Backbone.Collection.extend(_({model: Workspace}).extend(workspacesExtra));
var Projects = Backbone.Collection.extend({
model: Project