I want to schedule events, that will fire and call my predefined callback
How can schedule in js / jquery:
- one time event?
- recurring event (to call my function every minute, or five minutes)?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You want
setTimeoutfor a one time event andsetIntervalfor a repeating event.Both take two arguments: a function and an interval of time specified in milliseconds.
Bonus: if you keep around the values returned by calling these functions, you can cancel the callback if you need to.