Closed thom4parisot closed 10 years ago
@oncletom again, I really like this proposal.
If I understood your last question correctly...
Wondering what update() without any arguments would mean now or with config delay
...then I would assume that if no delay
configuration property was set when instantiating Imager then imgr.update();
should mean immediately.
But if a config property was set (for example delay: 50
) then imgr.update();
should mean "update in 50 milliseconds" (or however long in milliseconds the user specified)
Ok that makes sense :-)
And you understood well (hey, it looks like I start to be almost understandable codely-speaking ;-))
Getting there :-)
@oncletom just to confirm that I think this proposal seems fine to me.
The intention
Imager replaces the images either on the next Animation Frame or in the next supposed to be frame interval (16.6ms + 4ms w/
setTimeout
).We might not want to replace any
src
of a same pool at the same pace:orientationchange
: after some delay to let the device recalculating rightscroll
: after the last triggered event (or any third-party has loaded images after a scroll delay)My concern is Imager should not do too many things outside of its scope (resizing images when asked).
The proposal
This is especially relevant and less head-painful if events are not bundled anymore (cf. #25).
In any case, it will use
setTimeout
as a fallback ifrequestAnimationFrame
is not available. It will wait the correct amount of Animation Framesupdate(optional_delay)
Immediate:
In 500ms:
When I want:
delay
configuration optionWondering what
update()
without any arguments would mean now or with config delay.