I am creating an application in Javascript. The app should run a function one hour after a user has done a specifc action. What can I use to create these scheduled tasks to run the function?
Explanation of the use case: A user clicks her status to “active”, after one hour the status should automatically be changed to “inactive”.
You may use
setTimeout()for that:And
clearTimeout()to stop timeout in extra cases: