2025-07-14 10:54:06 +08:00

36 lines
890 B
TypeScript

import type { PluginContext, AnyTouchEvent } from '@any-touch/shared';
import Core from '@any-touch/core';
declare const DEFAULT_OPTIONS: {
name: string;
threshold: number;
velocity: number;
pointLength: number;
};
/**
* 实例
*/
declare type SwipeContext = PluginContext & typeof DEFAULT_OPTIONS;
/**
* 扩展插件映射
*/
declare module '@any-touch/core' {
interface PluginContextMap {
swipe: SwipeContext;
}
interface EventMap {
swipe: AnyTouchEvent;
swipeup: AnyTouchEvent;
swiperight: AnyTouchEvent;
swipedown: AnyTouchEvent;
swipeleft: AnyTouchEvent;
}
}
/**
* "拖拽"识别器
* @param at AnyTouch实例
* @param options 识别器选项
* @returns
*/
export default function (at: Core, options?: Partial<typeof DEFAULT_OPTIONS>): SwipeContext;
export {};