Last active
August 18, 2021 08:35
-
-
Save shiburagi/232df516b1959bda737c5e16ce530a76 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fn=(delay=5,rands=[20,10,15])=>{ | |
if(!loop) return; | |
console.log("click") | |
document.dispatchEvent(new Event('keydown', {keyCode: 'a'})) | |
setTimeout(fn, rands.reduce((s,v)=>s+Math.random()*v) +5); | |
} | |
startFn=()=>{ | |
loop = true | |
fn() | |
} | |
stopFn=()=>{ | |
loop =false | |
} | |
startFn() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
stop :
stopFn()