Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the difference between logical events and native events in GWT?

I notice that there are two methods by which an event handler can be hooked up to a GWT widget: addHandler and addDomHandler. The JavaDoc for addDomHandler says, "Adds a native event handler to the widget and sinks the corresponding native event. If you do not want to sink the native event, use the generic addHandler method instead."

I'd be very grateful if someone would enlighten me as to the difference between native events and logical events.

like image 306
David Avatar asked Nov 04 '10 02:11

David


People also ask

What is native event js?

Native events are fired directly by the browser - events like clicks, mouseovers, keypresses, etc. To receive those events on a Widget, you have to specifically sink the events. The generic events are, well, more generic.

What is native event in react native?

For React Native, events are received over the bridge that links native code with React. In short, whenever a View is created, React also passes its ID number over to native, so as to be able to receive all events related to that element.

What is the difference between event and Eventhandler?

In programming, an event handler is a callback routine that operates asynchronously once an event takes place. It dictates the action that follows the event. The programmer writes a code for this action to take place. An event is an action that takes place when a user interacts with a program.


1 Answers

Native events are fired directly by the browser - events like clicks, mouseovers, keypresses, etc. To receive those events on a Widget, you have to specifically sink the events.

The generic events are, well, more generic. For example, I've created a SaveEvent and a DeleteEvent for my own use, that get fired when certain UI conditions are met. They are farther away from the browser and would never get fired directly by the browser. I think you should stick with the more generic events when you can. On the other hand, if you're creating a custom widget that you can't make out of other widgets - for example, if you want to build a slider that the user can click and drag - you'll need the DOM events.

like image 79
Riley Lark Avatar answered Sep 20 '22 13:09

Riley Lark