Say we have few handlers for both events. The goal is to make sure, that all OpenEvent handlersfinish before any of CloseEvent handlers start their job. The old EventBus had a reverse order flag, which sometimes helped greatly in these particular cases. I.e. a handler, responsible for launching some process which leads to CloseEvent being fired (i.e. event emitter), usually registers itself to a bus first.
My question is: what's the best practice to establish the desirable behavior? So far as a workaround I use Scheduler.scheduleDeferred(Scheduler.ScheduledCommand cmd) to enqueueEventBus.fireEventFromSource(Event event, Object source) of CloseEvent call to the next browser's event loop tick.
p.s. My current thoughts are as follows. I don't want to rely of Timer or Scheduler (though it might be the only option, which I'm not sure about). Also I have no interest in introducing any flag variables, responsible for tracking which event occurred first. Instead, if one looks closer into theSimpleEventBus code, there's a firingDepth counter variable, which only works to delayaddHandler(...) and removeHandler(...) calls. It would be great, if same logic could be applied to order call sequences of handlers for different events.
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 firstname.lastname@example.org.
To post to this group, send email to email@example.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.
Post a Comment