Skip to content

⬅️ Back to Table of Contents

📄 directive.ts

📊 Analysis Summary

Metric Count
🔧 Functions 1
📦 Imports 8
📊 Variables & Constants 1
🟢 Vue Composition API 2
📑 Type Aliases 3

📚 Table of Contents

🛠️ File Location:

📂 packages/core/useMouseInElement/directive.ts

📦 Imports

Name Source
ObjectDirective vue
Reactive vue
MouseInElementOptions ./index
UseMouseInElementReturn ./index
reactiveOmit @vueuse/shared
reactive vue
watch vue
useMouseInElement ./index

Variables & Constants

Name Type Kind Value Exported
vMouseInElement `ObjectDirective<
HTMLElement,
BindingValueFunction BindingValueArray
>| const |{
mounted(el, binding) {
const [handler, options] = (typeof binding.value === 'function' ? [binding.value, {}] : binding.value) as BindingValueArray
const state = reactiveOmit(reactive(useMouseInElement(el, options)), 'stop')
watch(state, val => handler(val))

}, }` | ✓ |


Vue Composition API

Name Type Reactive Variables Composables
reactive reactive none none
watch watch none none

Functions

mounted(el: any, binding: any): void

Code
mounted(el, binding) {
    const [handler, options] = (typeof binding.value === 'function' ? [binding.value, {}] : binding.value) as BindingValueArray

    const state = reactiveOmit(reactive(useMouseInElement(el, options)), 'stop')
    watch(state, val => handler(val))
  }
  • Parameters:
  • el: any
  • binding: any
  • Return Type: void
  • Calls:
  • reactiveOmit (from @vueuse/shared)
  • reactive (from vue)
  • useMouseInElement (from ./index)
  • watch (from vue)
  • handler

Type Aliases

MouseInElement

type MouseInElement = Omit<UseMouseInElementReturn, 'stop'>;

BindingValueFunction

type BindingValueFunction = (mouse: Reactive<MouseInElement>) => void;

BindingValueArray

type BindingValueArray = [BindingValueFunction, MouseInElementOptions];