Browse Source

Editor: Check if IndexedDB is not available.

Mr.doob 11 years ago
parent
commit
cd7a3708bd
2 changed files with 8 additions and 8 deletions
  1. 0 5
      editor/index.html
  2. 8 3
      editor/js/Storage.js

+ 0 - 5
editor/index.html

@@ -36,11 +36,6 @@
 		<script src="../examples/js/renderers/SoftwareRenderer.js"></script>
 		<script src="../examples/js/renderers/SVGRenderer.js"></script>
 
-		<link href="js/libs/codemirror/codemirror.css" rel="stylesheet" />
-		<script src="js/libs/codemirror/codemirror.js"></script>
-		<script src="js/libs/codemirror/modes/javascript.js"></script>
-
-
 		<script src="js/libs/signals.min.js"></script>
 		<script src="js/libs/ui.js"></script>
 		<script src="js/libs/ui.editor.js"></script>

+ 8 - 3
editor/js/Storage.js

@@ -2,6 +2,11 @@ var Storage = function () {
 
 	var indexedDB = window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB;
 
+	if ( indexedDB === undefined  ) {
+		console.warn( 'Storage: IndexedDB not available.' );
+		return { init: function (){}, get: function (){}, set: function (){}, clear: function (){} };
+	}
+
 	var name = 'threejs-editor';
 	var version = 1;
 
@@ -35,7 +40,7 @@ var Storage = function () {
 				console.error( 'IndexedDB', event );
 
 			};
-			
+
 
 		},
 
@@ -75,11 +80,11 @@ var Storage = function () {
 			request.onsuccess = function ( event ) {
 
 				callback();
-			
+
 			};
 
 		}
 
 	}
 
-};
+};