Last active
December 25, 2022 10:34
-
-
Save Hacking-NASSA-with-HTML/4790517d65f8f75292c96a4745f31017 to your computer and use it in GitHub Desktop.
Self invoking function via setTimeout
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
// option 1 | |
(function cycle(i){ | |
console.log("tick, ID: " + i); | |
setTimeout(cycle, 2000, i+1); | |
})(0); | |
// option 2 | |
(function cycle() { | |
document.querySelector(".css-1ewhobe").click() | |
console.log("It's clicked") | |
setTimeout(cycle, 4000) | |
})() | |
// option 3 | |
(function cycle() { | |
document.getElementById('playMusic').click() | |
console.log("Button is clicked") | |
setTimeout(cycle, 4000) | |
})() | |
// option 4 | |
(() => { | |
let wait = 0; | |
// const clickMe = document.querySelectorAll(".classesYouNeedToClick") | |
const clickMe = document.querySelector(".css-1ewhobe") | |
clickMe.forEach(cl => { | |
setTimeout(() => { | |
cl.click(); | |
}, wait); | |
wait += 2000 | |
}) | |
})(); | |
// option 5 | |
(function cycle() { | |
const needToClick = document.querySelector(".css-1ewhobe") | |
needToClick.click() | |
console.log("It's clicked") | |
setTimeout(cycle, 4000) | |
})() | |
// option 6 | |
(function cycle(i) { | |
fetch("https://render-back-end-nikky-pedia.onrender.com/keep-alive") | |
console.log(`Address clicked + ${i} times`) | |
setTimeout(cycle, 4000, i + 1) | |
})(0) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment