Add support for Promise.allSettled
				
					
				
			Please see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/allSettled
This commit is contained in:
		
							parent
							
								
									4729fdc0e9
								
							
						
					
					
						commit
						2942233c9c
					
				| @ -230,11 +230,7 @@ if ( | |||||||
|       // need to be polyfilled for the IMAGE_DECODERS build target.
 |       // need to be polyfilled for the IMAGE_DECODERS build target.
 | ||||||
|       return; |       return; | ||||||
|     } |     } | ||||||
|     if ( |     if (globalThis.Promise && globalThis.Promise.allSettled) { | ||||||
|       globalThis.Promise && |  | ||||||
|       globalThis.Promise.prototype && |  | ||||||
|       globalThis.Promise.prototype.finally |  | ||||||
|     ) { |  | ||||||
|       return; |       return; | ||||||
|     } |     } | ||||||
|     globalThis.Promise = require("core-js/es/promise/index.js"); |     globalThis.Promise = require("core-js/es/promise/index.js"); | ||||||
|  | |||||||
| @ -551,13 +551,13 @@ class MessageHandler { | |||||||
|   async _deleteStreamController(streamId) { |   async _deleteStreamController(streamId) { | ||||||
|     // Delete the `streamController` only when the start, pull, and cancel
 |     // Delete the `streamController` only when the start, pull, and cancel
 | ||||||
|     // capabilities have settled, to prevent `TypeError`s.
 |     // capabilities have settled, to prevent `TypeError`s.
 | ||||||
|     await Promise.all( |     await Promise.allSettled( | ||||||
|       [ |       [ | ||||||
|         this.streamControllers[streamId].startCall, |         this.streamControllers[streamId].startCall, | ||||||
|         this.streamControllers[streamId].pullCall, |         this.streamControllers[streamId].pullCall, | ||||||
|         this.streamControllers[streamId].cancelCall, |         this.streamControllers[streamId].cancelCall, | ||||||
|       ].map(function(capability) { |       ].map(function(capability) { | ||||||
|         return capability && capability.promise.catch(function() {}); |         return capability && capability.promise; | ||||||
|       }) |       }) | ||||||
|     ); |     ); | ||||||
|     delete this.streamControllers[streamId]; |     delete this.streamControllers[streamId]; | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user