From 67d6d5508dbd38a8d2203bbe4347cac39ca5101d Mon Sep 17 00:00:00 2001 From: Matt Karl Date: Fri, 9 Dec 2022 15:15:55 -0500 Subject: [PATCH] Clarify the onProgress limitations in documentation --- packages/assets/src/Assets.ts | 5 +++-- packages/assets/src/loader/Loader.ts | 5 ++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/packages/assets/src/Assets.ts b/packages/assets/src/Assets.ts index f882d5b095..7c886e9cca 100644 --- a/packages/assets/src/Assets.ts +++ b/packages/assets/src/Assets.ts @@ -498,9 +498,10 @@ export class AssetsClass * // Load another bundle... * gameScreenAssets = await Assets.loadBundle('game-screen'); * @param bundleIds - the bundle id or ids to load - * @param onProgress - optional function that is called when progress on asset loading is made. + * @param onProgress - Optional function that is called when progress on asset loading is made. * The function is passed a single parameter, `progress`, which represents the percentage (0.0 - 1.0) - * of the assets loaded. + * of the assets loaded. Do not use this function to detect when assets are complete and available, + * instead use the Promise returned by this function. * @returns all the bundles assets or a hash of assets for each bundle specified */ public async loadBundle(bundleIds: string | string[], onProgress?: ProgressCallback): Promise diff --git a/packages/assets/src/loader/Loader.ts b/packages/assets/src/loader/Loader.ts index 169e73a579..97a5f35555 100644 --- a/packages/assets/src/loader/Loader.ts +++ b/packages/assets/src/loader/Loader.ts @@ -101,7 +101,10 @@ export class Loader * const assets = await Loader.load(['cool.png', 'cooler.png']); * console.log(assets); * @param assetsToLoadIn - urls that you want to load, or a single one! - * @param onProgress - a function that gets called when the progress changes + * @param onProgress - For multiple asset loading only, an optional function that is called + * when progress on asset loading is made. The function is passed a single parameter, `progress`, + * which represents the percentage (0.0 - 1.0) of the assets loaded. Do not use this function + * to detect when assets are complete and available, instead use the Promise returned by this function. */ public async load( assetsToLoadIn: string | LoadAsset,