Skip to content

⬅️ Back to Table of Contents

📄 tryOnUnmounted

📊 Analysis Summary

Metric Count
🔧 Functions 1
📦 Imports 4

📚 Table of Contents

🛠️ File Location:

📂 packages/shared/tryOnUnmounted/index.ts

📦 Imports

Name Source
ComponentInternalInstance vue
Fn ../utils
onUnmounted vue
getLifeCycleTarget ../utils

Functions

tryOnUnmounted(fn: Fn, target: ComponentInternalInstance | null): void

Call onUnmounted() if it's inside a component lifecycle, if not, do nothing

Parameters:

  • fn any: No description
  • target any: No description
Raw JSDoc
/**
 * Call onUnmounted() if it's inside a component lifecycle, if not, do nothing
 *
 * @param fn
 * @param target
 */

Calls:

  • getLifeCycleTarget (from ../utils)
  • onUnmounted (from vue)
Code
export function tryOnUnmounted(fn: Fn, target?: ComponentInternalInstance | null) {
  const instance = getLifeCycleTarget(target)
  if (instance)
    onUnmounted(fn, target)
}

Generated by Syntax Scribe