withProgress
withProgress<
T>(tasks,onProgress):Promise<{ -readonly [K in string | number | symbol]: Awaited<T[K]> }>
Waits for several loads like Promise.all and reports each one that finishes, for a loading bar:
const [t, s] = await withProgress([renderer.loadTextures({...}), audio.loadSounds({...})], (done, total) => (Sprite.w[bar] = (200 * done) / total)).
Each task counts once, so pass separate loads for a finer bar. Start the game first (game.start()) so the bar draws.
Type Parameters
Section titled “Type Parameters”T extends readonly unknown[]
Parameters
Section titled “Parameters”T
onProgress
Section titled “onProgress”(done, total) => void
Returns
Section titled “Returns”Promise<{ -readonly [K in string | number | symbol]: Awaited<T[K]> }>
