Skip to content

Commit

Permalink
bumb versions
Browse files Browse the repository at this point in the history
  • Loading branch information
martinmoeller committed Mar 15, 2020
1 parent 16c857d commit 69fdb1d
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/timeout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,15 @@ export const timeout: <T>(millis: number, f: (done: () => boolean) => Promise<T>
const result = f(doneF);
// result.finally(() => clearTimeout(timeoutRef));

result.then(resolve).catch(reject).finally(() => clearTimeout(timeoutRef));
result.then(
r => {
resolve(r);
clearTimeout(timeoutRef);
},
e => {
reject(e);
clearTimeout(timeoutRef);
}
);
});
};

0 comments on commit 69fdb1d

Please sign in to comment.