@@ -46,8 +46,10 @@ export class KeyboardClass {
46
46
try {
47
47
if ( inputIsString ( input ) ) {
48
48
for ( const char of input . join ( " " ) . split ( "" ) ) {
49
- await sleep ( this . config . autoDelayMs ) ;
50
- await this . providerRegistry . getKeyboard ( ) . type ( char ) ;
49
+ if ( this . config . autoDelayMs > 0 ) {
50
+ await sleep ( this . config . autoDelayMs ) ;
51
+ }
52
+ await this . providerRegistry . getKeyboard ( ) . type ( char ) ;
51
53
}
52
54
} else {
53
55
await this . providerRegistry . getKeyboard ( ) . click ( ...input as Key [ ] ) ;
@@ -73,7 +75,9 @@ export class KeyboardClass {
73
75
public pressKey ( ...keys : Key [ ] ) : Promise < KeyboardClass > {
74
76
return new Promise < KeyboardClass > ( async ( resolve , reject ) => {
75
77
try {
76
- await sleep ( this . config . autoDelayMs ) ;
78
+ if ( this . config . autoDelayMs > 0 ) {
79
+ await sleep ( this . config . autoDelayMs ) ;
80
+ }
77
81
await this . providerRegistry . getKeyboard ( ) . pressKey ( ...keys ) ;
78
82
resolve ( this ) ;
79
83
} catch ( e ) {
@@ -96,7 +100,9 @@ export class KeyboardClass {
96
100
public releaseKey ( ...keys : Key [ ] ) : Promise < KeyboardClass > {
97
101
return new Promise < KeyboardClass > ( async ( resolve , reject ) => {
98
102
try {
99
- await sleep ( this . config . autoDelayMs ) ;
103
+ if ( this . config . autoDelayMs > 0 ) {
104
+ await sleep ( this . config . autoDelayMs ) ;
105
+ }
100
106
await this . providerRegistry . getKeyboard ( ) . releaseKey ( ...keys ) ;
101
107
resolve ( this ) ;
102
108
} catch ( e ) {
0 commit comments