I have an issue, I need to delay a function in a bookmarklet, but im unsure how, since most delaying functions require more than one line of code
javascript:var result = confirm("Attempt to perform function"); if(result) while (true) { alert("function performed!")() } else { alert("Cancelled function."); }
I would like to add a delay between the confirmation of trying to perform a function, and when it actually performs the functions (maybe 3 seconds?) any suggestions? thanks.
(my friend recommended requestAnimationframe, but i am unsure how to implement this as well)