Procházet zdrojové kódy

Examples: replace Promise.finally()

Guilherme Avila před 5 roky
rodič
revize
2931b0b5fe

+ 11 - 1
examples/js/loaders/BasisTextureLoader.js

@@ -186,7 +186,17 @@ THREE.BasisTextureLoader.prototype = Object.assign( Object.create( THREE.Loader.
 			} );
 
 		texturePending
-			.finally( () => {
+			.then( () => {
+
+				if ( worker && taskID ) {
+
+					worker._taskLoad -= taskCost;
+					delete worker._callbacks[ taskID ];
+
+				}
+
+			} )
+			.catch( () => {
 
 				if ( worker && taskID ) {
 

+ 12 - 1
examples/js/loaders/DRACOLoader.js

@@ -198,7 +198,18 @@ THREE.DRACOLoader.prototype = Object.assign( Object.create( THREE.Loader.prototy
 
 		// Remove task from the task list.
 		geometryPending
-			.finally( () => {
+			.then( () => {
+
+				if ( worker && taskID ) {
+
+					this._releaseTask( worker, taskID );
+
+					// this.debug();
+
+				}
+
+			} )
+			.catch( () => {
 
 				if ( worker && taskID ) {
 

+ 11 - 1
examples/jsm/loaders/BasisTextureLoader.js

@@ -200,7 +200,17 @@ BasisTextureLoader.prototype = Object.assign( Object.create( Loader.prototype ),
 			} );
 
 		texturePending
-			.finally( () => {
+			.then( () => {
+
+				if ( worker && taskID ) {
+
+					worker._taskLoad -= taskCost;
+					delete worker._callbacks[ taskID ];
+
+				}
+
+			} )
+			.catch( () => {
 
 				if ( worker && taskID ) {
 

+ 12 - 1
examples/jsm/loaders/DRACOLoader.js

@@ -205,7 +205,18 @@ DRACOLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
 
 		// Remove task from the task list.
 		geometryPending
-			.finally( () => {
+			.then( () => {
+
+				if ( worker && taskID ) {
+
+					this._releaseTask( worker, taskID );
+
+					// this.debug();
+
+				}
+
+			} )
+			.catch( () => {
 
 				if ( worker && taskID ) {