Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 12 additions & 6 deletions src/imageLoader/internal/xhrRequest.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,18 @@ function xhrRequest(url, imageId, defaultHeaders = {}, params = {}) {
const xhr = new XMLHttpRequest();

xhr.open('get', url, true);
const beforeSendHeaders = options.beforeSend(
xhr,
imageId,
defaultHeaders,
params
);

let beforeSendHeaders = {};
try{
beforeSendHeaders = options.beforeSend(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is still a synchronous call. This is also not the current version - there is an options.open method that runs before on line 23. Since this is already a promise, it should be easy to change this into an async function on line 4, then return the result directly down below.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes it seems to be outdated base, @erasromani can you please rebase?

xhr,
imageId,
defaultHeaders,
params
);
} catch(err) {
console.error(err);
}

xhr.responseType = 'arraybuffer';

Expand Down