Home >Web Front-end >JS Tutorial >alert interrupt settimeout timing function_javascript skills

alert interrupt settimeout timing function_javascript skills

WBOY
WBOYOriginal
2016-05-16 17:27:551181browse

After testing, it was found that alert will interrupt the timing function of settimeout. After closing the dialog box, the settimeout time will start again, not from the point of interruption.

For example: settimeout executes a method after 5 minutes, but after waiting for 3 minutes, an alert pops up. After closing the alert, settimeout will start timing again and wait for another 5 minutes instead of 2 minutes.

And as long as it is in the same browser window, even in different frames, alert will interrupt the settimeout in other frames.

Why is it designed like this? I don’t understand. It’s because javascript is single-threaded. Of?

This is what I found in the IE browser. I have not tested other dialog boxes and pop-up boxes.

I really hope that HTML5 will be popularized soon, so that functions that require multi-threading can be solved.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn