Fixed 267U.pre2
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
// Returns T if promise settles before timeout, otherwise returns void, finishing execution in the background.
|
||||
export async function promiseEarlyReturn(promise, after) {
|
||||
const timer = new Promise((res)=>setTimeout(()=>res(undefined), after));
|
||||
return Promise.race([
|
||||
promise,
|
||||
timer
|
||||
]);
|
||||
}
|
||||
Reference in New Issue
Block a user