* Chain the provided promise after all previous promises have completed (ignoring errors in previous promises).
(promise: () => Promise<T>)
| 178 | * Chain the provided promise after all previous promises have completed (ignoring errors in previous promises). |
| 179 | */ |
| 180 | public chainFinally<T>(promise: () => Promise<T>): Promise<T> { |
| 181 | const deferred = createDeferred<T>(); |
| 182 | this.currentPromise = this.currentPromise.finally(() => |
| 183 | promise() |
| 184 | .then((result) => deferred.resolve(result)) |
| 185 | .catch((ex) => deferred.reject(ex)) |
| 186 | ); |
| 187 | return deferred.promise; |
| 188 | } |
| 189 | } |
| 190 | |
| 191 | export interface ITask<T> { |
no test coverage detected