From bc90789c71b5b6d90e445061b1692269c93dbf3c Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Thu, 14 Nov 2019 00:39:48 +0000 Subject: [PATCH] Remove unused promise utils method Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- src/utils/promise.js | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/src/utils/promise.js b/src/utils/promise.js index f7a2e7c3e7..8842bfa1b7 100644 --- a/src/utils/promise.js +++ b/src/utils/promise.js @@ -22,19 +22,6 @@ import Promise from "bluebird"; // Returns a promise which resolves with a given value after the given number of ms export const sleep = (ms: number, value: any): Promise => new Promise((resolve => { setTimeout(resolve, ms, value); })); -// Returns a promise which resolves when the input promise resolves with its value -// or when the timeout of ms is reached with the value of given timeoutValue -export async function timeout(promise: Promise, timeoutValue: any, ms: number): Promise { - const timeoutPromise = new Promise((resolve) => { - const timeoutId = setTimeout(resolve, ms, timeoutValue); - promise.then(() => { - clearTimeout(timeoutId); - }); - }); - - return Promise.race([promise, timeoutPromise]); -} - // Returns a Deferred export function defer(): {resolve: () => {}, reject: () => {}, promise: Promise} { let resolve;