Browse Source

Editor: Logging how long it took to save to IndexedDB.

Mr.doob 11 years ago
parent
commit
93f00b2acd
1 changed files with 3 additions and 1 deletions
  1. 3 1
      editor/js/Storage.js

+ 3 - 1
editor/js/Storage.js

@@ -54,12 +54,14 @@ var Storage = function () {
 
 		set: function ( data, callback ) {
 
+			var start = performance.now();
+
 			var transaction = database.transaction( [ 'states' ], 'readwrite' );
 			var objectStore = transaction.objectStore( 'states' );
 			var request = objectStore.put( data, 0 );
 			request.onsuccess = function ( event ) {
 
-				console.log( '[' + /\d\d\:\d\d\:\d\d/.exec( new Date() )[ 0 ] + ']', 'Saved state to IndexedDB.' );
+				console.log( '[' + /\d\d\:\d\d\:\d\d/.exec( new Date() )[ 0 ] + ']', 'Saved state to IndexedDB in ' + ( performance.now() - start ).toFixed( 2 ) + 'ms.' );
 
 			};