I think the generally adopted pattern is to schedule a task 100 or 250ms
away, and reschedule it on each scroll event (use a c.g.g.user.client.Timer
to be able to reschedule it).
Ideally, you'd also use a "passive event listener", but GWT doesn't expose
it: https://blog.chromium.org/2016/05/new-apis-to-help-developers-improve.html
(you'd have to use JSNI, which is prone to errors, browser
incompatibilities, and memory leaks)
BTW, I almost never use the "scrollbar", I use mousewheel on laptop/desktop
and touch on mobile/tablet.
On Friday, July 22, 2016 at 8:27:37 AM UTC+2, shiva raaj wrote:
>
> Thanks for response. But I need consider last request only. Basically I
> need to skip(eaten) all the previous request. I have logic to eat the
> request.But Is there any way to find out scroll bar is still scrolling
> without release the bar.
>
> Thank U
>
> On Thursday, 21 July 2016 18:18:25 UTC+5:30, Gilberto wrote:
>>
>> I don't know if that helps with your problem, but you could leave the
>> events as they are today and only make new requests to the server when the
>> previous one were executed.
>>
>> Something like this:
>>
>> private boolean requestingServer = false;
>>
>> public void onScroll(ScrollEvent scrollEvent) {
>> if (requestingServer) return;
>> requestingServer = true;
>> doServerRequest(new Callback(){ //pseudo code here for a callback
>> mechanism
>> public void onResponse(Payload something){
>> requestingServer = false;
>> }
>> });
>> }
>>
>> You can add a logic for a minimum delay between requests as well.
>>
>> This kind of code works on GWT because it is single threaded. In pure
>> Java you would need to create synchronized blocks to ensure that only one
>> request is being made to the server.
>>
>
--
You received this message because you are subscribed to the Google Groups "GWT
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.