Skip to content

⬅️ Back to Table of Contents

📄 tryOnBeforeUnmount

📊 Analysis Summary

Metric Count
🔧 Functions 1
📦 Imports 4

📚 Table of Contents

🛠️ File Location:

📂 packages/shared/tryOnBeforeUnmount/index.ts

📦 Imports

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

Functions

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

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

Parameters:

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

Calls:

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

Generated by Syntax Scribe