Use sleep from js-sdk as no point duplicating it

This commit is contained in:
Michael Telatynski 2021-07-01 22:55:27 +01:00
parent c0fab6647d
commit 88f691776f
11 changed files with 12 additions and 16 deletions

View file

@ -14,11 +14,6 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
// Returns a promise which resolves with a given value after the given number of ms
export function sleep<T>(ms: number, value?: T): Promise<T> {
return 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<T>(promise: Promise<T>, timeoutValue: T, ms: number): Promise<T> {