bindEmit.ts 383 B

12345678910111213
  1. // Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. import type { FormKitNode } from '@formkit/core'
  3. const bindEmit = (node: FormKitNode) => {
  4. const { props, context } = node
  5. if (!props.definition || !context || node.type !== 'input') return
  6. context.handlers.bindEmit = (name: string) => (e: Event) => node.emit(name, e)
  7. }
  8. export default bindEmit