LoadingManager.html 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8" />
  5. <base href="../../" />
  6. <script src="list.js"></script>
  7. <script src="page.js"></script>
  8. <link type="text/css" rel="stylesheet" href="page.css" />
  9. </head>
  10. <body>
  11. <h1>[name]</h1>
  12. <div class="desc">Handles and keeps track of loaded and pending data.</div>
  13. <code>
  14. var manager = new THREE.LoadingManager();
  15. manager.onProgress = function ( item, loaded, total ) {
  16. console.log( item, loaded, total );
  17. };
  18. var loader = new THREE.OBJLoader( manager );
  19. loader.load( 'file.obj', function ( object ) {
  20. //
  21. } );
  22. </code>
  23. <h2>Constructor</h2>
  24. <h3>[name]( [page:Function onLoad], [page:Function onProgress], [page:Function onError] )</h3>
  25. <div>
  26. [page:Function onLoad] — The function that needs to be called when all loaders are done.<br />
  27. [page:Function onProgress] — The function that needs to be called when an item is complete.<br />
  28. [page:Function onError] — The function that needs to be called when an item is errors.
  29. </div>
  30. <div>
  31. Creates a [name].
  32. </div>
  33. <h2>Properties</h2>
  34. <h3>[property:Function onLoad]</h3>
  35. <div>
  36. The function that needs to be called when all loaders are done.
  37. </div>
  38. <h3>[property:Function onProgress]</h3>
  39. <div>
  40. The function that needs to be called when an item is complete. The arguments are url(The url of the item just loaded),<br />
  41. loaded(the amount of items already loaded), total( The total amount of items to be loaded.)
  42. </div>
  43. <h3>[property:Function onError]</h3>
  44. <div>
  45. The function that needs to be called when an item errors.
  46. </div>
  47. <h2>Methods</h2>
  48. <h3>[method:null itemStart]( [page:String url] )</h3>
  49. <div>
  50. [page:String url] — the url to load
  51. </div>
  52. <div>
  53. This should be called by any loader used by the manager when the loader starts loading an url. These shouldn't be called outside a loader.
  54. </div>
  55. <h3>[method:null itemEnd]( [page:String url] )</h3>
  56. <div>
  57. [page:String url] — the loaded url
  58. </div>
  59. <div>
  60. This should be called by any loader used by the manager when the loader ended loading an url. These shouldn't be called outside a loader.
  61. </div>
  62. <h2>Example</h2>
  63. [example:webgl_loader_obj]
  64. <h2>Source</h2>
  65. [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
  66. </body>
  67. </html>