瀏覽代碼

add ability to use fetch options

Garrett Johnson 5 年之前
父節點
當前提交
ceaaebcb1d
共有 1 個文件被更改,包括 3 次插入2 次删除
  1. 3 2
      src/base/TilesRendererBase.js

+ 3 - 2
src/base/TilesRendererBase.js

@@ -34,6 +34,7 @@ export class TilesRendererBase {
 		this.tileSets = {};
 		this.rootSet = url;
 		this.lruCache = cache;
+		this.fetchOptions = { credentials: 'same-origin' };
 
 		this.downloadQueue = downloadQueue;
 		this.parseQueue = parseQueue;
@@ -201,7 +202,7 @@ export class TilesRendererBase {
 		if ( ! ( url in tileSets ) ) {
 
 			const pr =
-                fetch( url, { credentials: 'same-origin' } )
+                fetch( url, this.fetchOptions )
                 	.then( res => {
 
                 		if ( res.ok ) {
@@ -313,7 +314,7 @@ export class TilesRendererBase {
 
 			}
 
-			return fetch( tile.content.uri, { credentials: 'same-origin', signal } );
+			return fetch( tile.content.uri, Object.assign( { signal }, this.fetchOptions ) );
 
 		} )
 			.then( res => {