yeah, that's what I meant with putting the cancel() call in
onUnload().
Max
On Nov 24, 11:08 am, ep <eplisc...@googlemail.com> wrote:
> subclass a timer to your custom, which "binds" on a widget it works
> with. when the widget is detached your timer can cancel himself -
> kinda selfdestruction :)
>
> On 23 Nov., 17:26, Max Jonas Werner <m...@maxwerner.de> wrote:
>
> > Hi,
>
> > I have built a widget for my GWT application that shows the latest
> > actions users of the application have performed. To refresh this
> > widget automatically I use a Timer and its schedule() method like
> > this:
>
> > private final Timer t = new Timer() {
> > @Override
> > public void run() {
> > // perform RPC call here to refresh the list of activities
> > schedule(10000);
> > }
> > };
> > ...
> > t.schedule(10000);
>
> > I'm using schedule() here since scheduleRepeating() could lead to
> > shorter intervalls which I don't want to. However, I could also have
> > used scheduleRepeating() here, that's not the actual problem.
>
> > My problem/question is rather: When this widget is removed from the
> > DOM I'll have to cancel() the timer, so I override onUnload() and call
> > t.cancel() in there. Is this the method you would recommend or is
> > there some other fancy way of cancelling timers automatically when
> > widgets are unloaded/detached?
>
> > Thanks
> > Max
--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
No comments:
Post a Comment