diff --git a/docs/api/loaders/FileLoader.html b/docs/api/loaders/FileLoader.html index 3940432d564945..063b330b0d0307 100644 --- a/docs/api/loaders/FileLoader.html +++ b/docs/api/loaders/FileLoader.html @@ -24,7 +24,7 @@

Example

var loader = new THREE.FileLoader(); - //load a text file a output the result to the console + //load a text file and output the result to the console loader.load( // resource URL 'example.txt', @@ -47,27 +47,25 @@

Example

);
-

Constructor

- -

[name]( [param:LoadingManager manager] )

- [page:LoadingManager manager] — The [page:LoadingManager loadingManager] for the loader to use. - Default is [page:DefaultLoadingManager]. + Note: The cache must be enabled using + THREE.Cache.enabled = true; + This is a global property and only needs to be set once to be used by all loaders that use FileLoader internally. + [page:Cache Cache] is a cache module that holds the response from each request made through this loader, so each file is requested once.
-

Properties

+

Constructor

-

[property:Cache cache]

+

[name] ( [param:LoadingManager manager] )

- A reference to [page:Cache Cache] that hold the response from each request made - through this loader, so each file is requested once.

- - Note:The cache must be enabled using - THREE.Cache.enabled = true. - This is a global property and only needs to be set once to be used by all loaders that use FileLoader internally. + [page:LoadingManager manager] — The [page:LoadingManager loadingManager] for the loader to use. + Default is [page:DefaultLoadingManager].
+ +

Properties

+

[property:LoadingManager manager]

The [page:LoadingManager loadingManager] the loader is using. Default is [page:DefaultLoadingManager]. @@ -82,29 +80,31 @@

[property:String mimeType]

[property:String path]

The base path from which files will be loaded. See [page:.setPath]. Default is *undefined*.
+

[property:object requestHeader]

+
The [link:https://developer.mozilla.org/en-US/docs/Glossary/Request_header request header] used in HTTP request. See [page:.setRequestHeader]. Default is *undefined*.
+

[property:String responseType]

The expected response type. See [page:.setResponseType]. Default is *undefined*.

[property:String withCredentials]

- Whether the XMLHttpRequest uses credentials - see [page:.setWithCredentials]. + Whether the XMLHttpRequest uses credentials. See [page:.setWithCredentials]. Default is *undefined*.
-

Methods

[method:null load]( [param:String url], [param:Function onLoad], [param:Function onProgress], [param:Function onError] )

- [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].
- [page:Function onLoad] — Will be called when loading completes. The argument will be the loaded response.
- [page:Function onProgress] — Will be called while load progresses. The argument will be the XMLHttpRequest instance, - which contains .[page:Integer total] and .[page:Integer loaded] bytes.
- [page:Function onError] — Will be called if an error occurs.

- - Load the URL and pass the response to the onLoad function. + [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].
+ [page:Function onLoad] (optional) — Will be called when loading completes. The argument will be the loaded response.
+ [page:Function onProgress] (optional) — Will be called while load progresses. The argument will be the XMLHttpRequest instance, + which contains .[page:Integer total] and .[page:Integer loaded] bytes.
+ [page:Function onError] (optional) — Will be called if an error occurs.

+ + Load the URL and pass the response to the onLoad function.

[method:FileLoader setMimeType]( [param:String mimeType] )

@@ -119,28 +119,31 @@

[method:FileLoader setPath]( [param:String path] )

you are loading many models from the same directory.
-

[method:FileLoader setResponseType]( [param:String responseType] )

+

[method:FileLoader setRequestHeader]( [param:object requestHeader] )

- [page:String responseType] — Default is '' (empty string).

+ [page:object requestHeader] - key: The name of the header whose value is to be set. value: The value to set as the body of the header.

- Change the response type. Valid values are:
- [page:String text], empty string (default), or any other value. Any file type, returns the unprocessed file data.
- [page:String arraybuffer] - loads the data into a [link:https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer ArrayBuffer] and returns that.
- [page:String blob] - returns the data as a [link:https://developer.mozilla.org/en/docs/Web/API/Blob Blob].
- [page:String document] - parse the file using the [link:https://developer.mozilla.org/en-US/docs/Web/API/DOMParser DOMParser].
- [page:String json] - parse the file using [link:https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse JSON.parse].
+ Set the [link:https://developer.mozilla.org/en-US/docs/Glossary/Request_header request header] used in HTTP request. +
+

[method:FileLoader setResponseType]( [param:String responseType] )

+
+ Change the response type. Valid values are:
+ [page:String text] or empty string (default) - returns the data as [page:String string].
+ [page:String arraybuffer] - loads the data into a [link:https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer ArrayBuffer] and returns that.
+ [page:String blob] - returns the data as a [link:https://developer.mozilla.org/en/docs/Web/API/Blob Blob].
+ [page:String document] - parses the file using the [link:https://developer.mozilla.org/en-US/docs/Web/API/DOMParser DOMParser].
+ [page:String json] - parses the file using [link:https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse JSON.parse].

[method:FileLoader setWithCredentials]( [param:Boolean value] )

- 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].
- Note that this has no effect if you are loading files locally or from the same domain.
- + 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].
+ Note that this has no effect if you are loading files locally or from the same domain.
+

Source

[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]