Skip to content

Commit

Permalink
fetch support custom fetchOptions
Browse files Browse the repository at this point in the history
  • Loading branch information
deyihu committed Nov 19, 2024
1 parent 8907791 commit 00a8251
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/tileget.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,11 @@ function fetchTile(url, headers = {}, options) {
if (image) {
copyImageBitMap(image);
} else {
fetch(url, {
const fetchOptions = options.fetchOptions || {
headers,
referrer: options.referrer
}).then(res => res.blob()).then(blob => createImageBitmap(blob)).then(image => {
};
fetch(url, fetchOptions).then(res => res.blob()).then(blob => createImageBitmap(blob)).then(image => {
tileCache.add(url, image);
copyImageBitMap(image);
}).catch(error => {
Expand Down

0 comments on commit 00a8251

Please sign in to comment.