fix(core): update
This commit is contained in:
parent
3b0052602f
commit
734d5aca35
@ -84,11 +84,11 @@ export const map = async <T>(inputArg: T[], functionArg: IAsyncFunction<T>) => {
|
|||||||
return resultArray;
|
return resultArray;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const timeoutWrap = (ms, promise) => {
|
export const timeoutWrap = <T = any>(promiseArg: Promise<T>, timeoutInMs: number) => {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
reject(new Error('timeout'));
|
reject(new Error('timeout'));
|
||||||
}, ms);
|
}, timeoutInMs);
|
||||||
promise.then(resolve, reject);
|
promiseArg.then(resolve, reject);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user