@marko-tags/destroy-when-detached
Automatically clean up all Marko components within a container when it is removed and causes the onDestroy
lifecycle to be called.
This is particularly useful when embedding a Marko application via micro-frame
to allow cleanup when changing between pages.
Installation
npm install @marko-tags/destroy-when-detached
Example
// Place this at the root where you want to track removals.
// If using micro-frame this should be at your embedded applications page template.
<destroy-when-detached>
All children will go through the "onDestroy" lifecycle if this node is removed from the DOM.
</>