thinkpixellab / PxLoader

PxLoader is a simple JavasScript library for creating preloaders and resource downloaders for HTML5 apps.

Home Page:http://thinkpixellab.com/pxloader

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

progress listener outputs unpredictable sequence

dadastudio opened this issue · comments

Images are not loaded in an order that I set up. progress listener outputs unpredictable sequence.

This situation is in a sample 2 http://thinkpixellab.com/pxloader/ Report Progress While Images Load.

I got this:

Image 1 Loaded
Image 100 Loaded
Image 6 Loaded
Image 5 Loaded
Image 4 Loaded
Image 3 Loaded
Image 7 Loaded
...

Is this a normal behaviour? When images are cached an order is as expected. I run on OSX 10.7.3 (Safari, Chrome, Firefox...)

Yes, unfortunately we can only control the order that resources are requested. The resources may complete at different times for various reasons like transfer size or network delay. In most cases I think callers want to be notified as soon as a resource is ready. If you wanted sequential notifications it wouldn't be too hard to wrap the progress events and buffer notifications for events that arrive out of order.