Reputation: 14286
GWT introduced with version 1.6 handlers to be used instead of listeners. Now I was used to add and remove those listeners to achieve certain behavior.
But as I move towards using handlers I miss the remove methods. Like removeClickHandler for the click event.
Is there a way to do this, or am I missing something?
Upvotes: 5
Views: 7078
Reputation: 14286
I have found the solution
HandlerRegistration registration = addClickHandler(handler);
...
registration.removeHandler();
Upvotes: 3
Reputation: 13519
Each add...Handler
method returns the HandlerRegistration
interface. This interface contains the removeHandler()
method. If you want to remove handlers, simple store the returned interface in a variable and call removeHandler
when you want to remove the handler.
Upvotes: 12