Handles and keeps track of loaded and pending data.

Constructors

  • Parameters

    • Optional onLoad: (() => void)
        • (): void
        • Returns void

    • Optional onProgress: ((url, loaded, total) => void)
        • (url, loaded, total): void
        • Parameters

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

          Returns void

    • Optional onError: ((url) => void)
        • (url): void
        • Parameters

          • url: string

          Returns void

    Returns LoadingManager

Properties

onError: ((url) => 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

onLoad: (() => void)

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

Type declaration

    • (): void
    • Returns void

onProgress: ((url, loaded, total) => 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

onStart?: ((url, loaded, total) => 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

Methods

  • Parameters

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

    Returns this

  • Parameters

    • file: string

    Returns null | Loader<unknown, string>

  • Parameters

    • url: string

    Returns void

  • Parameters

    • url: string

    Returns void

  • Parameters

    • url: string

    Returns void

  • Parameters

    • regex: RegExp

    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

  • 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

    • Optional callback: ((url) => string)

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

        • (url): string
        • Parameters

          • url: string

          Returns string

    Returns this