pixi.js
    Preparing search index...

    Interface LoadOptions

    Options for loading assets with the Loader

    await Assets.load(['file1.png', 'file2.png'], {
    onProgress: (progress) => console.log(`Progress: ${progress * 100}%`),
    onError: (error, url) => console.error(`Error loading ${url}: ${error.message}`),
    strategy: 'retry', // 'throw' | 'skip' | 'retry'
    retryCount: 5, // Number of retry attempts if strategy is 'retry'
    retryDelay: 500, // Delay in ms between retries
    });
    interface LoadOptions {
        onError?: (error: Error, url: string | ResolvedAsset<any>) => void;
        onProgress?: (progress: number) => void;
        retryCount?: number;
        retryDelay?: number;
        strategy?: "skip" | "throw" | "retry";
    }
    Index

    Properties

    onError?: (error: Error, url: string | ResolvedAsset<any>) => void

    Callback for handling errors during loading

    Type declaration

      • (error: Error, url: string | ResolvedAsset<any>): void
      • Parameters

        • error: Error

          The error that occurred

        • url: string | ResolvedAsset<any>

          The URL of the asset that failed to load

        Returns void

    const options: LoadOptions = {
    onError: (error, url) => {
    console.error(`Failed to load ${url}: ${error.message}`);
    },
    };
    await Assets.load('missing-file.png', options);
    onProgress?: (progress: number) => void

    Callback for progress updates during loading

    Type declaration

      • (progress: number): void
      • Parameters

        • progress: number

          A number between 0 and 1 indicating the load progress

        Returns void

    const options: LoadOptions = {
    onProgress: (progress) => {
    console.log(`Loading progress: ${progress * 100}%`);
    },
    };
    await Assets.load('image.png', options);
    retryCount?: number

    Number of retry attempts if strategy is 'retry'

    3
    
    const options: LoadOptions = {
    strategy: 'retry',
    retryCount: 5, // Retry up to 5 times
    };
    await Assets.load('unstable-asset.png', options);
    retryDelay?: number

    Delay in milliseconds between retry attempts

    250
    
    const options: LoadOptions = {
    strategy: 'retry',
    retryDelay: 1000, // Wait 1 second between retries
    };
    await Assets.load('sometimes-fails.png', options);
    strategy?: "skip" | "throw" | "retry"

    Strategy to handle load failures

    • 'throw': Immediately throw an error and stop loading (default)
    • 'skip': Skip the failed asset and continue loading others
    • 'retry': Retry loading the asset a specified number of times
    'throw'
    
    const options: LoadOptions = {
    strategy: 'skip',
    };
    await Assets.load('sometimes-fails.png', options);