@@ -9,199 +9,185 @@ import { KeyboardAction } from "../provider/native/robotjs-keyboard-action.class
9
9
import { MouseAction } from "../provider/native/robotjs-mouse-action.class" ;
10
10
11
11
/**
12
- * NativeAdapter serves as an abstraction layer for all OS level interactions.
12
+ * { @link NativeAdapter} serves as an abstraction layer for all OS level interactions.
13
13
*
14
14
* This allows to provide a high level interface for native actions,
15
- * whithout having to spread (possibly) multiple dependencies all over the code.
15
+ * without having to spread (possibly) multiple dependencies all over the code.
16
16
* All actions which involve the OS are bundled in this adapter.
17
17
*/
18
18
export class NativeAdapter {
19
+ /**
20
+ * {@link NativeAdapter } class constructor
21
+ * @param clipboard {@link ClipboardActionProvider } instance used to interact with a systems clipboard (Default: {@link ClipboardAction})
22
+ * @param keyboard {@link KeyboardActionProvider } instance used to interact with a systems keybaord (Default: {@link KeyboardAction})
23
+ * @param mouse {@link MouseActionInterface } instance used to interact with a systems mouse (Default: {@link MouseAction})
24
+ */
19
25
constructor (
20
26
private clipboard : ClipboardActionProvider = new ClipboardAction ( ) ,
21
27
private keyboard : KeyboardActionProvider = new KeyboardAction ( ) ,
22
28
private mouse : MouseActionInterface = new MouseAction ( ) ,
23
29
) { }
24
30
25
31
/**
26
- * setMouseDelay configures mouse speed for movement
32
+ * { @link setMouseDelay} configures mouse speed for movement
27
33
*
28
- * @param {number } delay The delay
29
- * @memberof NativeAdapter
34
+ * @param delay Mouse delay in milliseconds
30
35
*/
31
36
public setMouseDelay ( delay : number ) : void {
32
37
this . mouse . setMouseDelay ( delay ) ;
33
38
}
34
39
35
40
/**
36
- * setKeyboardDelay configures keyboard delay between key presses
41
+ * { @link setKeyboardDelay} configures keyboard delay between key presses
37
42
*
38
- * @param {number } delay The delay
39
- * @memberof NativeAdapter
43
+ * @param delay The keyboard delay in milliseconds
40
44
*/
41
45
public setKeyboardDelay ( delay : number ) : void {
42
46
this . keyboard . setKeyboardDelay ( delay ) ;
43
47
}
44
48
45
49
/**
46
- * setMousePosition changes the current mouse cursor position to a given point
50
+ * { @link setMousePosition} changes the current mouse cursor position to a given { @link Point }
47
51
*
48
- * @param {Point } p The new cursor position
49
- * @memberof NativeAdapter
52
+ * @param p The new cursor position at {@link Point} p
50
53
*/
51
54
public setMousePosition ( p : Point ) : Promise < void > {
52
55
return this . mouse . setMousePosition ( p ) ;
53
56
}
54
57
55
58
/**
56
- * getMousePosition returns the current mouse position
59
+ * { @link currentMousePosition } returns the current mouse position
57
60
*
58
- * @returns {Promise<Point> } Current cursor position
59
- * @memberof NativeAdapter
61
+ * @returns Current cursor position at a certain {@link Point}
60
62
*/
61
63
public currentMousePosition ( ) : Promise < Point > {
62
64
return this . mouse . currentMousePosition ( ) ;
63
65
}
64
66
65
67
/**
66
- * leftClick triggers a native left-click event via OS API
67
- *
68
- * @memberof NativeAdapter
68
+ * {@link leftClick } triggers a native left-click event via OS API
69
69
*/
70
70
public leftClick ( ) : Promise < void > {
71
71
return this . mouse . leftClick ( ) ;
72
72
}
73
73
74
74
/**
75
- * rightClick triggers a native right-click event via OS API
76
- *
77
- * @memberof NativeAdapter
75
+ * {@link rightClick } triggers a native right-click event via OS API
78
76
*/
79
77
public rightClick ( ) : Promise < void > {
80
78
return this . mouse . rightClick ( ) ;
81
79
}
82
80
83
81
/**
84
- * middleClick triggers a native middle-click event via OS API
82
+ * { @link middleClick} triggers a native middle-click event via OS API
85
83
*/
86
84
public middleClick ( ) : Promise < void > {
87
85
return this . mouse . middleClick ( ) ;
88
86
}
89
87
90
88
/**
91
- * pressButton presses and holds a mouse button
89
+ * { @link pressButton} presses and holds a mouse { @link Button }
92
90
*
93
- * @param {Button } btn The mouse button to press
94
- * @memberof NativeAdapter
91
+ * @param btn The mouse {@link Button} to press
95
92
*/
96
93
public pressButton ( btn : Button ) : Promise < void > {
97
94
return this . mouse . pressButton ( btn ) ;
98
95
}
99
96
100
97
/**
101
- * releaseButton releases a mouse button previously clicked via pressButton
98
+ * { @link releaseButton} releases a mouse { @link Button } previously clicked via { @link pressButton}
102
99
*
103
- * @param {Button } btn The mouse button to release
104
- * @memberof NativeAdapter
100
+ * @param btn The mouse {@link Button} to release
105
101
*/
106
102
public releaseButton ( btn : Button ) : Promise < void > {
107
103
return this . mouse . releaseButton ( btn ) ;
108
104
}
109
105
110
106
/**
111
- * type types a given string via native keyboard events
107
+ * { @link type} types a given string via native keyboard events
112
108
*
113
- * @param {string } input The text to type
114
- * @memberof NativeAdapter
109
+ * @param input The text to type
115
110
*/
116
111
public type ( input : string ) : Promise < void > {
117
112
return this . keyboard . type ( input ) ;
118
113
}
119
114
120
115
/**
121
- * click clicks a single Key via native keyboard event
116
+ * { @link click} clicks a { @link Key} via native keyboard event
122
117
*
123
- * @param {Key[] } keys The keys to click
124
- * @memberof NativeAdapter
118
+ * @param keys Array of {@link Key}s to click
125
119
*/
126
120
public click ( ...keys : Key [ ] ) : Promise < void > {
127
121
return this . keyboard . click ( ...keys ) ;
128
122
}
129
123
130
124
/**
131
- * pressKey presses and holds a given Key
125
+ * { @link pressKey} presses and holds a given { @link Key}
132
126
*
133
- * @param {Key[] } keys The Keys to press and hold
134
- * @memberof NativeAdapter
127
+ * @param keys Array of {@link Key}s to press and hold
135
128
*/
136
129
public pressKey ( ...keys : Key [ ] ) : Promise < void > {
137
130
return this . keyboard . pressKey ( ...keys ) ;
138
131
}
139
132
140
133
/**
141
- * releaseKey releases a Key previously presses via pressKey
134
+ * { @link releaseKey} releases a { @link Key} previously presses via { @link pressKey}
142
135
*
143
- * @param {Key[] } keys The Keys to release
144
- * @memberof NativeAdapter
136
+ * @param keys Array of {@link Key}s to release
145
137
*/
146
138
public releaseKey ( ...keys : Key [ ] ) : Promise < void > {
147
139
return this . keyboard . releaseKey ( ...keys ) ;
148
140
}
149
141
150
142
/**
151
- * scrollUp triggers an upwards mouse wheel scroll
143
+ * { @link scrollUp} triggers an upwards mouse wheel scroll
152
144
*
153
- * @param {number } amount The amount of 'ticks' to scroll
154
- * @memberof NativeAdapter
145
+ * @param amount The amount of 'ticks' to scroll
155
146
*/
156
147
public scrollUp ( amount : number ) : Promise < void > {
157
148
return this . mouse . scrollUp ( amount ) ;
158
149
}
159
150
160
151
/**
161
- * scrollDown triggers a downward mouse wheel scroll
152
+ * { @link scrollDown} triggers a downward mouse wheel scroll
162
153
*
163
- * @param {number } amount The amount of 'ticks' to scroll
164
- * @memberof NativeAdapter
154
+ * @param amount The amount of 'ticks' to scroll
165
155
*/
166
156
public scrollDown ( amount : number ) : Promise < void > {
167
157
return this . mouse . scrollDown ( amount ) ;
168
158
}
169
159
170
160
/**
171
- * scrollLeft triggers a left mouse scroll
161
+ * { @link scrollLeft} triggers a left mouse scroll
172
162
*
173
- * @param {number } amount The amount of 'ticks' to scroll
174
- * @memberof NativeAdapter
163
+ * @param amount The amount of 'ticks' to scroll
175
164
*/
176
165
public scrollLeft ( amount : number ) : Promise < void > {
177
166
return this . mouse . scrollLeft ( amount ) ;
178
167
}
179
168
180
169
/**
181
- * scrollRight triggers a right mouse scroll
170
+ * { @link scrollRight} triggers a right mouse scroll
182
171
*
183
- * @param {number } amount The amount of 'ticks' to scroll
184
- * @memberof NativeAdapter
172
+ * @param amount The amount of 'ticks' to scroll
185
173
*/
186
174
public scrollRight ( amount : number ) : Promise < void > {
187
175
return this . mouse . scrollRight ( amount ) ;
188
176
}
189
177
190
178
/**
191
- * copy copies a given text to the system clipboard
179
+ * { @link copy} copies a given text to the system clipboard
192
180
*
193
- * @param {string } text The text to copy
194
- * @memberof NativeAdapter
181
+ * @param text The text to copy
195
182
*/
196
183
public copy ( text : string ) : Promise < void > {
197
184
return this . clipboard . copy ( text ) ;
198
185
}
199
186
200
187
/**
201
- * paste pastes the current text on the system clipboard
188
+ * { @link paste} pastes the current text on the system clipboard
202
189
*
203
- * @returns {Promise<string> } The clipboard text
204
- * @memberof NativeAdapter
190
+ * @returns The clipboard text
205
191
*/
206
192
public paste ( ) : Promise < string > {
207
193
return this . clipboard . paste ( ) ;
0 commit comments