chore: DRY up mouse.click() (#9725)

This commit is contained in:
Paul Irish 2023-02-21 12:50:43 -08:00 committed by GitHub
parent 9910aae2f7
commit 81bf443789
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -478,18 +478,14 @@ export class Mouse {
options: MouseOptions & {delay?: number} = {}
): Promise<void> {
const {delay = null} = options;
await this.move(x, y);
await this.down(options);
if (delay !== null) {
await this.move(x, y);
await this.down(options);
await new Promise(f => {
return setTimeout(f, delay);
});
await this.up(options);
} else {
await this.move(x, y);
await this.down(options);
await this.up(options);
}
await this.up(options);
}
/**