Skip to content

Commit

Permalink
style: default
Browse files Browse the repository at this point in the history
  • Loading branch information
bvandercar-vt committed May 7, 2024
1 parent 40b2d19 commit f4868e0
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions src/spoof.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export interface GhostCursor {
// Helper function to wait a specified number of milliseconds
const delay = async (ms: number): Promise<void> => {
if (ms < 1) return
await new Promise((resolve) => setTimeout(resolve, ms))
return await new Promise((resolve) => setTimeout(resolve, ms))
}

/**
Expand Down Expand Up @@ -287,11 +287,7 @@ export const createCursor = (
await tracePath(path(previous, rand, options), true)
previous = rand
}
if (options?.moveDelay !== undefined && options.moveDelay >= 0) {
await delay(Math.random() * options.moveDelay)
} else {
await delay(Math.random() * 2000) // 2s by default
}
await delay(Math.random() * (options?.moveDelay ?? 2000))
randomMove().then(
(_) => {},
(_) => {}
Expand Down Expand Up @@ -326,11 +322,7 @@ export const createCursor = (
log('Warning: could not click mouse, error message:', error)
}

if (options?.moveDelay !== undefined && options.moveDelay >= 0) {
await delay(Math.random() * options.moveDelay)
} else {
await delay(Math.random() * 2000) // 2s by default
}
await delay(Math.random() * (options?.moveDelay ?? 2000))

actions.toggleRandomMove(true)
},
Expand Down

0 comments on commit f4868e0

Please sign in to comment.