[name]

Handles and keeps track of loaded and pending data. A default global instance of this class is created and used by loaders if not supplied manually - see [page:DefaultLoadingManager].

In general that should be sufficient, however there are times when it can be useful to have seperate loaders - for example if you want to show seperate loading bars for objects and textures.

Example

[example:webgl_loader_babylon WebGL / loader / babylon]
[example:webgl_loader_fbx WebGL / loader / fbx]
[example:webgl_loader_obj WebGL / loader / obj]
[example:webgl_materials_reflectivity WebGL / materials / reflectivity]
[example:webgl_postprocessing_outline WebGL / postprocesing / outline]
[example:webgl_terrain_dynamic WebGL / terrain / dynamic]
var manager = new v3d.LoadingManager(); manager.onStart = function(url, itemsLoaded, itemsTotal) { console.log('Started loading file: ' + url + '.\nLoaded ' + itemsLoaded + ' of ' + itemsTotal + ' files.'); }; manager.onLoad = function() { console.log('Loading complete!'); }; manager.onProgress = function(url, itemsLoaded, itemsTotal) { console.log('Loading file: ' + url + '.\nLoaded ' + itemsLoaded + ' of ' + itemsTotal + ' files.'); }; manager.onError = function(url) { console.log('There was an error loading ' + url); }; var loader = new v3d.OBJLoader(manager); loader.load('file.obj', function(object) { // });

Constructor

[name]([page:Function onLoad], [page:Function onProgress], [page:Function onError])

[page:Function onLoad] — (optional) this function will be called when all loaders are done.
[page:Function onProgress] — (optional) this function will be called when an item is complete.
[page:Function onError] — (optional) this function will be called a loader encounters errors.
Creates a new [name].

Properties

[property:Function onStart]

This function will be called when loading starts. The arguments are:
[page:String url] — The url of the item just loaded.
[page:Integer itemsLoaded] — the number of items already loaded so far.
[page:Iteger itemsTotal] — the total amount of items to be loaded.

By default this is undefined.

[property:Function onLoad]

This function will be called when all loading is completed. By default this is undefined, unless passed in the constructor.

[property:Function onProgress]

This function will be called when an item is complete. The arguments are:
[page:String url] — The url of the item just loaded.
[page:Integer itemsLoaded] — the number of items already loaded so far.
[page:Iteger itemsTotal] — the total amount of items to be loaded.

By default this is undefined, unless passed in the constructor.

[property:Function onError]

This function will be called when any item errors, with the argument:
[page:String url] — The url of the item that errored.

By default this is undefined, unless passed in the constructor.

Methods

Note: The following methods are designed to be called internally by loaders. You shouldn't call them directly.

[method:null itemStart]([page:String url])

[page:String url] — the url to load

This should be called by any loader using the manager when the loader starts loading an url.

[method:null itemEnd]([page:String url])

[page:String url] — the loaded url

This should be called by any loader using the manager when the loader ended loading an url.

[method:null itemError]([page:String url])

[page:String url] — the loaded url

This should be called by any loader using the manager when the loader errors loading an url.
[sourceHint]