Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use XMLHttpRequest to load image and get progress #29

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

romanenko
Copy link

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 on Image() 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 of tiger.svg file instead of just the url string.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant