X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=ui%2Fweb%2Fsrc%2Fcomposables%2FUtils.ts;h=07848f36d41b8a8f285ae817b117ddaf6bdb2178;hb=98262391ccaa5d00fac1ec8a1707d7fbba33cc3a;hp=9e1277a84beaeea04d35c0ec4bcc6fd749a8b79c;hpb=6ebeab4b8404e5a9d69b3dcdff47b9087b2058f0;p=e-mobility-charging-stations-simulator.git diff --git a/ui/web/src/composables/Utils.ts b/ui/web/src/composables/Utils.ts index 9e1277a8..07848f36 100644 --- a/ui/web/src/composables/Utils.ts +++ b/ui/web/src/composables/Utils.ts @@ -18,28 +18,6 @@ export const ifUndefined = (value: T | undefined, isValue: T): T => { // if (isIterable(obj) === false) cb(); // }; -export const promiseWithTimeout = ( - promise: Promise, - timeoutMs: number, - timeoutError: Error, - timeoutCallback: () => void = () => { - /* This is intentional */ - }, -): Promise => { - // Create a timeout promise that rejects in timeout milliseconds - const timeoutPromise = new Promise((_, reject) => { - setTimeout(() => { - // FIXME: The original promise state shall be checked - timeoutCallback(); - // FIXME: The original promise shall be canceled - reject(timeoutError); - }, timeoutMs); - }); - - // Returns a race between timeout promise and the passed promise - return Promise.race([promise, timeoutPromise]); -}; - // export const compose = (...fns: ((arg: T) => T)[]): ((x: T) => T) => { // return (x: T) => fns.reduceRight((y, fn) => fn(y), x); // };