Refactoring: move some loading logic into svelte element

This commit is contained in:
Pieter Vander Vennet 2025-01-23 13:03:12 +01:00
parent 8354da0fe1
commit 06c096b21a
5 changed files with 84 additions and 102 deletions

View file

@ -1125,9 +1125,14 @@ In the case that MapComplete is pointed to the testing grounds, the edit will be
element.click()
}
public static async waitFor(timeMillis: number): Promise<void> {
public static async waitFor(timeMillis: number): Promise<void>;
public static async waitFor<T>(timeMillis: number, t: T): Promise<T>;
public static async waitFor<T = void>(timeMillis: number, t: T): Promise<T> {
return new Promise((resolve) => {
window.setTimeout(resolve, timeMillis)
window.setTimeout(() => {
resolve(t)
}, timeMillis)
})
}