UNPKG

717 BTypeScriptView Raw
1import { Loader } from './Loader';
2import { LoadingManager } from './LoadingManager';
3
4/**
5 * A loader for loading an image.
6 * Unlike other loaders, this one emits events instead of using predefined callbacks. So if you're interested in getting notified when things happen, you need to add listeners to the object.
7 */
8export class ImageLoader extends Loader {
9 constructor(manager?: LoadingManager);
10
11 load(
12 url: string,
13 onLoad?: (image: HTMLImageElement) => void,
14 onProgress?: (event: ProgressEvent) => void,
15 onError?: (event: ErrorEvent) => void,
16 ): HTMLImageElement;
17
18 loadAsync(url: string, onProgress?: (event: ProgressEvent) => void): Promise<HTMLImageElement>;
19}