2
0
Эх сурвалжийг харах

Finished updated FileLoader doc

looeee 8 жил өмнө
parent
commit
620758c1a5

+ 46 - 26
docs/api/loaders/FileLoader.html

@@ -26,24 +26,25 @@ var loader = new THREE.FileLoader();
 
 //load a text file a output the result to the console
 loader.load(
-	// resource URL
-	'example.txt',
-
-	// Function when resource is loaded
-	function ( data ) {
-		// output the text to the console
-		console.log( data )
-	},
-
-	// Function called when download progresses
-	function ( xhr ) {
-		console.log( (xhr.loaded / xhr.total * 100) + '% loaded' );
-	},
-
-	// Function called when download errors
-	function ( xhr ) {
-		console.error( 'An error happened' );
-	} );
+    // resource URL
+    'example.txt',
+
+    // Function when resource is loaded
+    function ( data ) {
+        // output the text to the console
+        console.log( data )
+    },
+
+    // Function called when download progresses
+    function ( xhr ) {
+        console.log( (xhr.loaded / xhr.total * 100) + '% loaded' );
+    },
+
+    // Function called when download errors
+    function ( xhr ) {
+        console.error( 'An error happened' );
+    }
+);
 		</code>
 
 		<h2>Constructor</h2>
@@ -81,9 +82,7 @@ loader.load(
 
 		<h3>[property:String withCredentials]</h3>
 		<div>
-			Whether the XMLHttpRequest uses credentials  such as cookies, authorization headers or
-			TLS client certificates. See [page:.setWithCredentials] and
-			[link:https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/withCredentials XMLHttpRequest.withCredentials].
+			Whether the XMLHttpRequest uses credentials - see [page:.setWithCredentials].
 			Default is *undefined*.
 		</div>
 
@@ -93,19 +92,31 @@ loader.load(
 
 		<h3>[method:null load]( [page:String url], [page:Function onLoad], [page:Function onProgress], [page:Function onError] )</h3>
 		<div>
-		[page:String url] — required<br />
+		[page:String url] — the path or URL to the file. This can also be a
+			[link:https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs Data URI].<br />
 		[page:Function onLoad] — Will be called when loading completes. The argument will be the loaded response.<br />
-		[page:Function onProgress] — Will be called while load progresses. The argument will be the XmlHttpRequest instance, that contain .[page:Integer total] and .[page:Integer loaded] bytes.<br />
+		[page:Function onProgress] — Will be called while load progresses. The argument will be the XmlHttpRequest instance,
+			that contains .[page:Integer total] and .[page:Integer loaded] bytes.<br />
 		[page:Function onError] — Will be called if an error occurs.<br /><br />
 
-		Begin loading from url and return the [page:String text] response that will contain the data.
+		Load the URL and pass the response to the onLoad function.
 		</div>
 
+		<h3>[method:FileLoader setMimeType]( [page:String mimeType] )</h3>
+		<div>
+			Set the expected [link:https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types mimeType]
+			of the file being loaded. Note that in many cases this will be determined automatically, so by default it is *undefined*.
+		</div>
 
+		<h3>[method:FileLoader setPath]( [page:String path] )</h3>
+		<div>
+			Set the base path or URL from which to load files. This can be useful if, for example, you are loading many models from the
+		same directory.
+		</div>
 
-		<h3>[method:null setResponseType]( [page:String value] )</h3>
+		<h3>[method:FileLoader setResponseType]( [page:String responseType] )</h3>
 		<div>
-		[page:String value] — the response type. Default is '' (empty string).<br /><br />
+		[page:String responseType] — Default is '' (empty string).<br /><br />
 
 		Change the response type. Valid values are:<br />
 		[page:String text], empty string (default), or any other value. Any file type, returns the unprocessed file data.<br />
@@ -116,6 +127,15 @@ loader.load(
 
 		</div>
 
+		<h3>[method:FileLoader setWithCredentials]( [page:Boolean value] )</h3>
+		Whether the XMLHttpRequest uses credentials such as cookies, authorization headers or
+		TLS client certificates. See
+		[link:https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/withCredentials XMLHttpRequest.withCredentials].<br />
+		Note that this has no effect if you are loading files locally or from the same domain.
+		<div>
+
+		</div>
+
 		<h2>Source</h2>
 
 		[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]