Thursday, October 12, 2017

Re: Custom Events and Elements with Elemental 2



On Wednesday, October 11, 2017 at 4:12:14 PM UTC+2, nikola wrote:

  Users would expect to have events with source from where event was fired. That was source field in GWT events. In your implementation we will need to intercept DOM event and fire new event with source field of custom element. (e.g re-fire through EventHandler). This is kind of double work. 

  Another thing that we need to care about is if add and then remove some custom element from DOM like element.removeChild(customElement.asElement()) we also need to remove reference to custom element to be garbage collected? Since only asElement() is removed from DOM not custom element object itself. If I'm right...

  This is why it would be good if custom element can extends Element and wrap inner element like Widget Composite.

I'm really not clear about what you want to do, and what you actually mean by "custom element".
Do you mean Web Components? In this case, they'd have to extend HTMLElement and, at least with elemental2-dom 1.0.0-beta-1, set the connectedCallback, attachedCalback, etc. Encapsulation is then provided by the shadow DOM.
Or do you mean "kind of widgets, that just happen to map one-to-one with a DOM element and its subtree"? In this case, you're indeed *wrapping* an element, and that means you're going to have parallel hierarchies or such widgets/components on one hand, and DOM elements on the other hand, and will need to maintain both in sync (this is what GWT Widgets do, and I believe more or less how React works too).

--
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 google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment