Statement: Elm is difficult to adopt for some groups because they require 
UI controls that may be difficult or time-prohibitive to re-implement.

Current Approach: Use ports to initialize controls by passing the id of a 
DOM element to use as the container.

Problem: Using ports to wire UI controls can cause memory leaks because 
there's no indication when a DOM element has been removed. When these DOM 
elements disappear there's no way to clean up event handlers or other GC 
roots.

Due Diligence: I've put together an example of one type of memory leak 
that's possible using a jQuery Date picker control:

https://github.com/joeandaverde/elm-jquery-memory-leak

The README contains a short gif of the memory leak in action.

Solutions to being notified when a DOM element is created or removed have 
been proposed in various (closed) issues in virtual-dom and this list. I 
understand these lifecycle hooks have been acknowledged as a useful tool. I 
propose that these lifecycle hooks are more than a convenience and instead 
required in order to prevent memory leaks and aid adoption of Elm.


-- 
You received this message because you are subscribed to the Google Groups "Elm 
Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to