-
Notifications
You must be signed in to change notification settings - Fork 11
/
keyboard_en.d.ts
82 lines (78 loc) · 2.61 KB
/
keyboard_en.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
export type TouchType = 'touchstart' | 'touchend' | 'touchcancel';
export interface OnTouchEventResponse {
/**
* The event type, which is read-only. Valid values: `touchstart`, `touchend`, `touchcancel`.
*/
readonly type: TouchType;
/**
* The `key` of the key
*/
readonly key: string;
/**
* The `code` of the key
*/
readonly code: number;
}
export interface KeyboardConfig {
/**
* The keyboard mount node. Default value: TCGSDK init param `mount`.
*/
zone?: HTMLElement;
/**
* Whether to send the keyboard data automatically. Default value: `true`.
*/
sendData?: boolean;
/**
* The frame color of a key. Default value: `#4a525a`.
*/
keyBorderColor?: any;
/**
* The frame color of a pressed key. Default value: `#2684FF`
*/
keyPressedBorderColor?: any;
/**
* Keyboard OnTouchEventResponse
*/
onTouchEvent?: (response: OnTouchEventResponse) => void;
}
/**
*
* Virtual keyboard
*
* It relies on TCGSDK. We recommend you use it in the callback function onConnectSuccess in TCGSDK.init.
*
* @param {Object} params
* @param {HTMLElement} [params.zone=TCGSDK init param `mount`] - The keyboard mount node. Default value: TCGSDK init param `mount`.
* @param {boolean} [params.sendData=true] - Whether to send the keyboard data automatically. Default value: `true`.
* @param {string} [params.keyBorderColor='#4a525a'] - The frame color of a key. Default value: `#4a525a`.
* @param {Object} [params.keyPressedBorderColor='#2684FF'] - The frame color of a pressed key. Default value: `#2684FF`
* @param {Function} [params.onTouchEvent] - Keyboard OnTouchEventResponse
*
* @description
* OnTouchEventResponse:
*
* | Name | Type | Description |
* | ------- | ---------- | --------------------------------------------------------------- |
* | type | string | The event type, which is read-only. Valid values: `touchstart`, `touchend`, `touchcancel`. |
* | key | string | The `key` of the key, which is read-only. |
* | code | string | The `code` of the key, which is read-only.
*
* @example
* new Keyboard({});
*/
declare class Keyboard {
constructor(params: KeyboardConfig);
/**
* This API is used to display the virtual keyboard.
*/
show(): void;
/**
* This API is used to hide the virtual keyboard.
*/
hide(): void;
/**
* This API is used to terminate the virtual keyboard and delete the corresponding node (to use the virtual keyboard again, you need to create a new one).
*/
destroy(): void;
}
export default Keyboard;