Pārlūkot izejas kodu

added loadAsync to ZH doc

Lewy Blue 5 gadi atpakaļ
vecāks
revīzija
0cdc91d313
1 mainītis faili ar 12 papildinājumiem un 0 dzēšanām
  1. 12 0
      docs/api/zh/loaders/Loader.html

+ 12 - 0
docs/api/zh/loaders/Loader.html

@@ -57,6 +57,18 @@
 			This method needs to be implement by all concrete loaders. It holds the logic for loading the asset from the backend.
 		</p>
 
+		<h3>[method:Promise loadAsync]( [param:String url], [param:Function onProgress] )</h3>
+		<p>
+		[page:String url] — A string containing the path/URL of the <em>.gltf</em> or <em>.glb</em> file.<br />
+		[page:Function onProgress] — (optional) A function to be called while the loading is in progress. The argument will be the XMLHttpRequest instance, that contains .[page:Integer total] and .[page:Integer loaded] bytes.<br />
+		</p>
+		<p>
+		This method is equivalent to [page:.load], but returns a [link:https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise Promise].
+		</p>
+		<p>
+		[page:Function onLoad] is handled by [link:https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/resolve Promise.resolve] and [page:Function onError] is handled by [link:https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/reject Promise.reject].
+		</p>
+
 		<h3>[method:void parse]()</h3>
 		<p>
 			This method needs to be implement by all concrete loaders. It holds the logic for parsing the asset into three.js entities.