ソースを参照

LoadingManager: setResourceTransform -> setURLModifier.

And, resolveResourceURL -> resolveURL.
Don McCurdy 7 年 前
コミット
09de3f3102

+ 7 - 7
docs/api/loaders/managers/LoadingManager.html

@@ -121,22 +121,22 @@
 
 
 		<h2>Methods</h2>
 		<h2>Methods</h2>
 
 
-		<h3>[method:null setResourceTransform]( [page:Function callback] )</h3>
+		<h3>[method:null setURLModifier]( [page:Function callback] )</h3>
 		<div>
 		<div>
-		[page:Function callback] — transform callback. Called with [page:String url] argument, and
+		[page:Function callback] — URL modifier callback. Called with [page:String url] argument, and
 		must return [page:String resolvedURL].<br /><br />
 		must return [page:String resolvedURL].<br /><br />
 
 
-		If provided, the transform callback will be passed each resource URL before a request is sent.
-		The callback may return the original URL, or a new URL to override loading behavior. This
+		If provided, the callback will be passed each resource URL before a request is sent. The
+		callback may return the original URL, or a new URL to override loading behavior. This
 		behavior can be used to load assets from .ZIP files, drag-and-drop APIs, and Data URIs.
 		behavior can be used to load assets from .ZIP files, drag-and-drop APIs, and Data URIs.
 		</div>
 		</div>
 
 
-		<h3>[method:String resolveResourceURL]( [page:String url] )</h3>
+		<h3>[method:String resolveURL]( [page:String url] )</h3>
 		<div>
 		<div>
 		[page:String url] — the url to load<br /><br />
 		[page:String url] — the url to load<br /><br />
 
 
-		Given a URL, uses the resource transform callback (if any) and returns a resolved URL. If no
-		transform is set, returns the original URL.
+		Given a URL, uses the URL modifier callback (if any) and returns a resolved URL. If no
+		URL modifier is set, returns the original URL.
 		</div>
 		</div>
 
 
 		<br /><br />
 		<br /><br />

+ 1 - 1
src/loaders/FileLoader.js

@@ -19,7 +19,7 @@ Object.assign( FileLoader.prototype, {
 
 
 		if ( this.path !== undefined ) url = this.path + url;
 		if ( this.path !== undefined ) url = this.path + url;
 
 
-		url = this.manager.resolveResourceURL( url );
+		url = this.manager.resolveURL( url );
 
 
 		var scope = this;
 		var scope = this;
 
 

+ 1 - 1
src/loaders/ImageLoader.js

@@ -22,7 +22,7 @@ Object.assign( ImageLoader.prototype, {
 
 
 		if ( this.path !== undefined ) url = this.path + url;
 		if ( this.path !== undefined ) url = this.path + url;
 
 
-		url = this.manager.resolveResourceURL( url );
+		url = this.manager.resolveURL( url );
 
 
 		var scope = this;
 		var scope = this;
 
 

+ 6 - 6
src/loaders/LoadingManager.js

@@ -9,7 +9,7 @@ function LoadingManager( onLoad, onProgress, onError ) {
 	var isLoading = false;
 	var isLoading = false;
 	var itemsLoaded = 0;
 	var itemsLoaded = 0;
 	var itemsTotal = 0;
 	var itemsTotal = 0;
-	var resourceTransform = undefined;
+	var urlModifier = undefined;
 
 
 	this.onStart = undefined;
 	this.onStart = undefined;
 	this.onLoad = onLoad;
 	this.onLoad = onLoad;
@@ -68,11 +68,11 @@ function LoadingManager( onLoad, onProgress, onError ) {
 
 
 	};
 	};
 
 
-	this.resolveResourceURL = function ( url ) {
+	this.resolveURL = function ( url ) {
 
 
-		if ( resourceTransform ) {
+		if ( urlModifier ) {
 
 
-			return resourceTransform( url );
+			return urlModifier( url );
 
 
 		}
 		}
 
 
@@ -80,9 +80,9 @@ function LoadingManager( onLoad, onProgress, onError ) {
 
 
 	};
 	};
 
 
-	this.setResourceTransform = function ( transform ) {
+	this.setURLModifier = function ( transform ) {
 
 
-		resourceTransform = transform;
+		urlModifier = transform;
 
 
 	};
 	};
 
 

+ 4 - 4
test/unit/src/loaders/LoadingManager.js

@@ -2,21 +2,21 @@
  * @author Don McCurdy / https://github.com/donmccurdy
  * @author Don McCurdy / https://github.com/donmccurdy
  */
  */
 
 
-QUnit.module( "LoadingManager" );
+QUnit.module( 'LoadingManager' );
 
 
-QUnit.test( "setResourceTransform", function( assert ) {
+QUnit.test( 'setURLModifier', function( assert ) {
 
 
 	var manager = new THREE.LoadingManager();
 	var manager = new THREE.LoadingManager();
 	var suffix = '?transformed=true';
 	var suffix = '?transformed=true';
 
 
-	manager.setResourceTransform( function ( url ) {
+	manager.setURLModifier( function ( url ) {
 
 
 		return url + suffix;
 		return url + suffix;
 
 
 	} );
 	} );
 
 
 	var url = 'https://foo.bar/baz';
 	var url = 'https://foo.bar/baz';
-	var resolvedURL = manager.resolveResourceURL( url );
+	var resolvedURL = manager.resolveURL( url );
 	assert.equal( resolvedURL, url + suffix, 'URL transform is applied' );
 	assert.equal( resolvedURL, url + suffix, 'URL transform is applied' );
 
 
 });
 });