Wednesday, October 26, 2016

Re: HowTo use GWT EvenBus to schedule OpenEvent -> CloseEvent sequence

Given that JS is single threaded using Scheduler.scheduleDeferred is your only option. You could write your own EventBus implementation that might use Scheduler.scheduleDeferred internally so that an event, fired during another event being processed, gets delayed to the next browser event loop.

Generally I try to code things independent of ordering assumptions, especially if the EventBus interface your are programming against does not define any ordering rules. Might be better to have a class that knows how many open events to expect and is then responsible to fire close event(s), some sort of an open/close event manager. That way you have your specific requirement explicitly documented in code rather than implicitly covered through some EventBus implementation (that might change).

-- J.

--
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 google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment