1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-11-25 05:23:13 +03:00

Replace usages of setImmediate with setTimeout for wider compatibility (#4240)

Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
This commit is contained in:
Michael Telatynski
2024-06-13 16:01:33 +01:00
committed by GitHub
parent 5a3d24abc2
commit 4cb851c51a
3 changed files with 22 additions and 3 deletions

View File

@@ -407,9 +407,12 @@ export async function logDuration<T>(logger: BaseLogger, name: string, block: ()
/**
* Promise/async version of {@link setImmediate}.
*
* Implementation is based on `setTimeout` for wider compatibility.
* @deprecated Use {@link sleep} instead.
*/
export function immediate(): Promise<void> {
return new Promise(setImmediate);
return new Promise((resolve) => setTimeout(resolve));
}
export function isNullOrUndefined(val: any): boolean {