On 20 juil, 22:57, Nathan Wells <nwwe...@gmail.com> wrote: > What is the purpose of registering event handlers? I originally > thought it was to avoid memory leaks, but that doesn't seem to be > true, given that the whole point of the handler API was to avoid > accidental memory leaks, making so that developers didn't have to > worry about it. Is it just to allow the code that is registering the > handler to later de-register it?
Originally, removeHandler wasn't public, so HandlerRegistration was the only way to remove a previously added handler. People have asked that removeHandler be made public (and not @Deprecated), and they apparently had compelling-enough arguments. HandlerRegistration can still be used in cases where you need event- and handler-agnostic (and even target-agnostic) ways of unregistering events. I think gwt-presenter (or some other "MVP framework") uses this to automatically unregister all added handlers without the need to code anything. -- 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-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.