Skip to content

⬅️ Back to Table of Contents

📄 useSupported

📊 Analysis Summary

Metric Count
🔧 Functions 1
📦 Imports 3
🟢 Vue Composition API 1
📑 Type Aliases 1

📚 Table of Contents

🛠️ File Location:

📂 packages/core/useSupported/index.ts

📦 Imports

Name Source
ComputedRef vue
computed vue
useMounted ../useMounted

Vue Composition API

Name Type Reactive Variables Composables
computed computed none none

Functions

useSupported(callback: () => unknown): UseSupportedReturn

Parameters:

  • callback () => unknown

Returns: UseSupportedReturn

Calls:

  • useMounted (from ../useMounted)
  • computed (from vue)
  • Boolean
  • callback

Internal Comments:

// to trigger the ref (x3)
// eslint-disable-next-line ts/no-unused-expressions (x3)

Code
export function useSupported(callback: () => unknown): UseSupportedReturn {
  const isMounted = useMounted()

  return computed(() => {
    // to trigger the ref
    // eslint-disable-next-line ts/no-unused-expressions
    isMounted.value
    return Boolean(callback())
  })
}

Type Aliases

UseSupportedReturn

type UseSupportedReturn = ComputedRef<boolean>;

Generated by Syntax Scribe