Created
November 23, 2023 01:54
-
-
Save LiF-Lee/170bbf6b6fe74d22a057a3bfb236489a to your computer and use it in GitHub Desktop.
Scheduled callback
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
(async (ScheduleDate, Callback) => { | |
const Log = (text, color) => console.log(text, `color: ${color}`); | |
Log(`Scheduled callback at %c${ScheduleDate.toLocaleString()}`, 'red'); | |
const CheckTime = () => Date.now() >= ScheduleDate.getTime() | |
? (Log(`Scheduled callback executed at %c${new Date().toLocaleString()}`, 'green'), Callback()) | |
: requestAnimationFrame(CheckTime); | |
requestAnimationFrame(CheckTime); | |
})(new Date('2023-11-23 10:38:50'), () => { | |
const Query = '#app > div > a'; | |
document.querySelector(Query).click(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment