LexiFi / ocaml-vdom

Elm architecture and (V)DOM for OCaml
MIT License
197 stars 13 forks source link

Disposing custom elements #32

Closed mlasson closed 4 years ago

mlasson commented 4 years ago

Description

This PR adds the ability to dispose custom elements when they are blitted out of the dom. Also it adds the possibility to access the parent of the custom element when instanciating the element.

This allows to implement "subscription-like" listener (see the resize example). Our to add features that interect with the global states and requires to install and then uninstall some stateful instance (see the tippy example).

Note: it is possible to attach features on an empty text node if one does not want to mess with element tree (but beware not to attach any attribute that are not event handler).

I think, this work very well.

It is ready for ready for review @alainfrisch.