vue-toastify
Version:
<p align="center">Simple and dependency-free notification plugin.</p>
50 lines (49 loc) • 1.18 kB
TypeScript
import type { Coordinates } from './useDraggable';
/**
* Event name mapping to the payload of the type.
*/
type EventMap = {
vtDragFinished: {
id: string;
position: Coordinates;
};
vtBeingDragged: {
id: string;
position: Coordinates;
};
vtDragStarted: {
id: string;
position: Coordinates;
};
vtDismissed: {
id: string;
};
vtStarted: {
id: string;
};
vtFinished: {
id: string;
};
vtLoadStop: {
id: string;
};
vtPromptResponse: {
id: string;
response: any;
};
vtPaused: {
id: string;
};
vtResumed: {
id: string;
};
};
export type EventName = keyof EventMap;
type Events = {
on: <T extends EventName>(event: T, callback: (payload: EventMap[T]) => void) => void;
once: <T extends EventName>(event: T, callback: (payload: EventMap[T]) => void) => void;
off: <T extends EventName>(event: T, callback?: (payload: EventMap[T]) => void) => void;
emit: <T extends EventName>(event: T, payload: EventMap[T]) => void;
};
export default function useVtEvents(): Events;
export {};