Nowadays I really try to run code from the event loop when possible. It can cause a big decrease in complexity, because each event handler runs in a fresh context with all of the program's invariants established. When implementing code that will run at the top level of the call stack, you don't have to reason about what arbitrary event might already be in progress while trying to run the new one.
Unfortunately, AJAX might strike again against this principle. Eugene Lazutkin has written an in-depth defense of the event-loop architecture I sketch above. Unfortunately, one of the important tools for using this approach is apparently crippled in every single browser:
I ran this code on different browsers and different operating systems and it turned out that all of them have the minimal timeout time. Setting the timeout time lower than that value doesn't reduce the timeout.
"Lower than that value" includes a timeout of 0.
I wonder how hard it would be for GWT to work around this and make zero-timeout events really work?
No comments:
Post a Comment