Sfoglia il codice sorgente

OBJLoader: Nicer handling of callback.

Mr.doob 13 anni fa
parent
commit
b571a8000e
1 ha cambiato i file con 3 aggiunte e 3 eliminazioni
  1. 3 3
      examples/js/loaders/OBJLoader.js

+ 3 - 3
examples/js/loaders/OBJLoader.js

@@ -14,7 +14,7 @@ THREE.OBJLoader.prototype.load = function ( url, callback ) {
 
 
 			if ( xhr.status == 200 || xhr.status == 0 ) {
 			if ( xhr.status == 200 || xhr.status == 0 ) {
 
 
-				THREE.OBJLoader.prototype.parse( xhr.responseText, callback );
+				callback( THREE.OBJLoader.prototype.parse( xhr.responseText ) );
 
 
 			} else {
 			} else {
 
 
@@ -31,7 +31,7 @@ THREE.OBJLoader.prototype.load = function ( url, callback ) {
 
 
 };
 };
 
 
-THREE.OBJLoader.prototype.parse = function ( data, callback ) {
+THREE.OBJLoader.prototype.parse = function ( data ) {
 
 
 	var geometry = new THREE.Geometry();
 	var geometry = new THREE.Geometry();
 
 
@@ -132,6 +132,6 @@ THREE.OBJLoader.prototype.parse = function ( data, callback ) {
 
 
 	geometry.computeCentroids();
 	geometry.computeCentroids();
 
 
-	callback( geometry );
+	return geometry;
 
 
 }
 }