Use XMLHttpRequest to load image and get progress #29
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I tried to implement image fetching using XMLHttpRequest to receive progress events and pass them to
preloader
function. This might be useful to have some kind of progress bar component as a preloader.Straightforward listening for
onprogress
event onImage()
instance gave no effect, because XMLHttpRequest Level 2 proposal features are not yet implemented, even in modern browsers.This PR is not yet ready to merge. However I would like to discuss this idea and its implementation. Using XMLHttpRequest requires server to have proper CORS configuration and the way I made request handling with
window.URL.createObjectURL
FileAPI function makes this component uncompatible with IE <= 9.Two test cases are falling: checking equality of
src
prop of rendered<img />
component also needs to be adapted to a new API, we need to compare it with encoded blob contents oftiger.svg
file instead of just the url string.