For example;
They are my links, HomePage – Users
When I click homepage load js code. How I can interrupt when click Users this running code and start again.
Thanks for answers.
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.
First of all, your individual Javascript functions should only be running for split seconds. There should be no single long-running function that you need to actually interrupt. If there is, you need to design it so it is interruptable. Like:
When you want to interrupt the function, you set the global
stopFlagtotrueand the function will exit soonish. That’s rarely a necessary design pattern in the browser though (and only possible to a limited extend in the first place due to the single-threadedness of JS).The best answer I can give to this vague and broad question of yours: design your Javascript in a way that you don’t have this problem in the first place.