mitt-vue
Version:
Lightweight utility for integrating mitt with Vue 2 and Vue 3
10 lines (9 loc) • 432 B
TypeScript
import { ComponentOptions } from 'vue';
import { EventCallback } from './types';
/**
* Provides Vue 2 mixins for registering event listeners.
* @param event - The event name to listen for.
* @param callback - The callback to invoke when the event is emitted.
* @returns A Vue mixin with `created` and `beforeDestroy` hooks.
*/
export declare function useEventListener(event: string, callback: EventCallback): ComponentOptions;