Przeglądaj źródła

Examples: simplify logic - include comment note

Guilherme Avila 5 lat temu
rodzic
commit
9d661d6915

+ 2 - 10
examples/js/loaders/BasisTextureLoader.js

@@ -185,7 +185,9 @@ THREE.BasisTextureLoader.prototype = Object.assign( Object.create( THREE.Loader.
 
 			} );
 
+		// Note: replaced '.finally()' with '.catch().then()' block - iOS 11 support (#19416)
 		texturePending
+			.catch( () => true )
 			.then( () => {
 
 				if ( worker && taskID ) {
@@ -195,16 +197,6 @@ THREE.BasisTextureLoader.prototype = Object.assign( Object.create( THREE.Loader.
 
 				}
 
-			} )
-			.catch( () => {
-
-				if ( worker && taskID ) {
-
-					worker._taskLoad -= taskCost;
-					delete worker._callbacks[ taskID ];
-
-				}
-
 			} );
 
 		return texturePending;

+ 2 - 11
examples/js/loaders/DRACOLoader.js

@@ -197,7 +197,9 @@ THREE.DRACOLoader.prototype = Object.assign( Object.create( THREE.Loader.prototy
 			.then( ( message ) => this._createGeometry( message.geometry ) );
 
 		// Remove task from the task list.
+		// Note: replaced '.finally()' with '.catch().then()' block - iOS 11 support (#19416)
 		geometryPending
+			.catch( () => true )
 			.then( () => {
 
 				if ( worker && taskID ) {
@@ -208,17 +210,6 @@ THREE.DRACOLoader.prototype = Object.assign( Object.create( THREE.Loader.prototy
 
 				}
 
-			} )
-			.catch( () => {
-
-				if ( worker && taskID ) {
-
-					this._releaseTask( worker, taskID );
-
-					// this.debug();
-
-				}
-
 			} );
 
 		// Cache the task result.

+ 2 - 10
examples/jsm/loaders/BasisTextureLoader.js

@@ -199,7 +199,9 @@ BasisTextureLoader.prototype = Object.assign( Object.create( Loader.prototype ),
 
 			} );
 
+		// Note: replaced 'finally()' with .catch().then() block - iOS 11 support (#19416)
 		texturePending
+			.catch( () => true )
 			.then( () => {
 
 				if ( worker && taskID ) {
@@ -209,16 +211,6 @@ BasisTextureLoader.prototype = Object.assign( Object.create( Loader.prototype ),
 
 				}
 
-			} )
-			.catch( () => {
-
-				if ( worker && taskID ) {
-
-					worker._taskLoad -= taskCost;
-					delete worker._callbacks[ taskID ];
-
-				}
-
 			} );
 
 		return texturePending;

+ 2 - 11
examples/jsm/loaders/DRACOLoader.js

@@ -204,7 +204,9 @@ DRACOLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
 			.then( ( message ) => this._createGeometry( message.geometry ) );
 
 		// Remove task from the task list.
+		// Note: replaced 'finally()' with .catch().then() block - iOS 11 support (#19416)
 		geometryPending
+			.catch( () => true )
 			.then( () => {
 
 				if ( worker && taskID ) {
@@ -215,17 +217,6 @@ DRACOLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
 
 				}
 
-			} )
-			.catch( () => {
-
-				if ( worker && taskID ) {
-
-					this._releaseTask( worker, taskID );
-
-					// this.debug();
-
-				}
-
 			} );
 
 		// Cache the task result.