forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
jquery.finger.d.ts
109 lines (92 loc) · 3.64 KB
/
jquery.finger.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
// Type definitions for jquery.finger.js
// Project: http://ngryman.sh/jquery.finger/
// Definitions by: Max Ackley <https://github.com/maxackley/>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="../jquery/jquery.d.ts"/>
declare module JQueryFinger {
export interface JQueryFingerOptions {
/**
* The time the user must hold in order to fire a press event. If this
* time is not reached, a tap event will be fired instead.
* Default: 300(ms).
*/
pressDuration: number;
/**
* The maximum time between two tap events to fire a doubletap event.
* If this time is reached, two distinct tap events will be fired instead.
* Default: 300(ms).
*/
doubleTapInterval: number;
/**
* The maximum time the user will have to swipe in order to fire a flick
* event. If this time is reached, only drag events will continue to be
* fired.
* Default: 150(ms).
*/
flickDuration: number;
/**
* The number of pixels the user will have to move in order to fire motion
* events (drag or flick). If this time is not reached, no motion will
* be handled and tap, doubletap or press event will be fired.
* Default: 5(px).
*/
motionThreshhold: number;
/**
* Globally prevents every native default behavior.
* Default: undefined.
*/
preventDefault: boolean;
}
}
interface JQueryFingerEventObject extends JQueryEventObject {
/**
* The x page coordinate.
*/
x: number;
/**
* The y page coordinate.
*/
y: number;
/**
* The x delta since the last event.
*/
dx: number;
/**
* The y delta since the last event.
*/
dy: number;
/**
* The absolute x delta since the last event.
*/
adx: number;
/**
* The absolute y delta since the last event.
*/
ady: number;
/**
* The orientation of the motion. Adjusted by $.Finger.motionThreshhold.
* Value is 'horizontal' or 'vertical'.
*/
orientation: string;
/**
* The direction of the motion. Value is 1 if the motion is 'positive'
* (left-to-right or top-to-bottom) or -1 if 'negative'(right-to-left or
* bottom-to-top).
*/
direction: number;
}
interface JQuery {
on(events: 'tap', handler: (eventObject: JQueryFingerEventObject, ...args: any[]) => any): JQuery;
on(events: 'doubletap', handler: (eventObject: JQueryFingerEventObject, ...args: any[]) => any): JQuery;
on(events: 'press', handler: (eventObject: JQueryFingerEventObject, ...args: any[]) => any): JQuery;
on(events: 'drag', handler: (eventObject: JQueryFingerEventObject, ...args: any[]) => any): JQuery;
on(events: 'flick', handler: (eventObject: JQueryFingerEventObject, ...args: any[]) => any): JQuery;
on(events: 'tap', data: any, handler: (eventObject: JQueryFingerEventObject, ...args: any[]) => any): JQuery;
on(events: 'doubletap', data: any, handler: (eventObject: JQueryFingerEventObject, ...args: any[]) => any): JQuery;
on(events: 'press', data: any, handler: (eventObject: JQueryFingerEventObject, ...args: any[]) => any): JQuery;
on(events: 'drag', data: any, handler: (eventObject: JQueryFingerEventObject, ...args: any[]) => any): JQuery;
on(events: 'flick', data: any, handler: (eventObject: JQueryFingerEventObject, ...args: any[]) => any): JQuery;
}
interface JQueryStatic {
Finger: JQueryFinger.JQueryFingerOptions;
}