Class LoadingManager

Handles and keeps track of loaded and pending data.

Constructors

  • Parameters

    • OptionalonLoad: (() => void)
        • (): void
        • Returns void

    • OptionalonProgress: ((url: string, loaded: number, total: number) => void)
        • (url, loaded, total): void
        • Parameters

          • url: string
          • loaded: number
          • total: number

          Returns void

    • OptionalonError: ((url: string) => void)
        • (url): void
        • Parameters

          • url: string

          Returns void

    Returns LoadingManager

Properties

onStart?: ((url: string, loaded: number, total: number) => void)

Will be called when loading of an item starts.

Type declaration

    • (url, loaded, total): void
    • Parameters

      • url: string

        The url of the item that started loading.

      • loaded: number

        The number of items already loaded so far.

      • total: number

        The total amount of items to be loaded.

      Returns void

onLoad: (() => void)

Will be called when all items finish loading.
The default is a function with empty body.

onProgress: ((url: string, loaded: number, total: number) => void)

Will be called for each loaded item.
The default is a function with empty body.

Type declaration

    • (url, loaded, total): void
    • Parameters

      • url: string

        The url of the item just loaded.

      • loaded: number

        The number of items already loaded so far.

      • total: number

        The total amount of items to be loaded.

      Returns void

onError: ((url: string) => void)

Will be called when item loading fails.
The default is a function with empty body.

Type declaration

    • (url): void
    • Parameters

      • url: string

        The url of the item that errored.

      Returns void

Methods

  • If provided, the callback will be passed each resource URL before a request is sent.
    The callback may return the original URL, or a new URL to override loading behavior.
    This behavior can be used to load assets from .ZIP files, drag-and-drop APIs, and Data URIs.

    Parameters

    • Optionalcallback: ((url: string) => string)

      URL modifier callback. Called with url argument, and must return resolvedURL.

        • (url): string
        • Parameters

          • url: string

          Returns string

    Returns this

  • Given a URL, uses the URL modifier callback (if any) and returns a resolved URL.
    If no URL modifier is set, returns the original URL.

    Parameters

    • url: string

      the url to load

    Returns string

  • Parameters

    • url: string

    Returns void

  • Parameters

    • url: string

    Returns void

  • Parameters

    • url: string

    Returns void

  • Parameters

    • regex: RegExp
    • loader: Loader<unknown, string>

    Returns this

  • Parameters

    • regex: RegExp

    Returns this

  • Parameters

    • file: string

    Returns null | Loader<unknown, string>