Explorar el Código

[js] add Promise.finally (closes #9589)

Dan Korostelev hace 5 años
padre
commit
dd7dd309c2
Se han modificado 1 ficheros con 7 adiciones y 0 borrados
  1. 7 0
      std/js/lib/Promise.hx

+ 7 - 0
std/js/lib/Promise.hx

@@ -87,6 +87,13 @@ extern class Promise<T> {
 	@:native("catch")
 	@:overload(function<TOut>(onRejected:PromiseHandler<Dynamic, TOut>):Promise<EitherType<T, TOut>> {})
 	function catchError(onRejected:PromiseHandler<Dynamic, T>):Promise<T>;
+
+	/**
+		Returns a Promise. When the promise is settled, i.e either fulfilled or rejected,
+		the specified callback function is executed. This provides a way for code to be run
+		whether the promise was fulfilled successfully or rejected once the Promise has been dealt with.
+	**/
+	function finally(onFinally:()->Void):Promise<T>;
 }
 
 /**