-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.d.ts
53 lines (53 loc) · 1.46 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/**
* bind event
* @param target window | HTMLElement
* @param type event type
* @param handler event handler
* @param capture if capture phase
*/
export declare function on(target: Window | HTMLElement, type: string, handler: EventHandler, capture?: boolean | AddEventListenerOptions): void;
/**
* unbind event
* @param target window | HTMLElement
* @param type event type
* @param handler event handler
* @param capture if capture phase
*/
export declare function off(target: Window | HTMLElement, type: string, handler: EventHandler, capture?: boolean | AddEventListenerOptions): void;
/**
* if position is out of visible screen
* @param x x coordinate
* @param y y coordinate
*/
export declare function withinBoundry(x: number, y: number): boolean;
/**
* To bind event
* @param el taget element. required.
* @param options event handlers and other configration. required.
*/
export default function XTouch(el: Window | HTMLElement, options: IOptions): () => void;
/**
* configration options
*/
export interface IOptions {
/**
* the third arg for `addEventListenner`
*/
capture?: boolean | AddEventListenerOptions;
/**
* touchstart/mousedown event handler
*/
onStart: EventHandler;
/**
* touchmove/mousemove event handler
*/
onMove: EventHandler;
/**
* touchend/mouseup event handler
*/
onEnd: EventHandler;
}
/**
* event callback.
*/
export declare type EventHandler = (e: TouchEvent) => void;