@marko-tags/destroy-when-detached

0.1.4 • Public • Published


@marko-tags/destroy-when-detached
API Stability NPM Version Downloads

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.
</>

Dependencies (0)

    Dev Dependencies (0)

      Package Sidebar

      Install

      npm i @marko-tags/destroy-when-detached

      Weekly Downloads

      0

      Version

      0.1.4

      License

      MIT

      Unpacked Size

      5.86 kB

      Total Files

      8

      Last publish

      Collaborators

      • dylanpiercey
      • mlrawlings
      • agliga