Home > Web Front-end > JS Tutorial > body text

JavaScript优化专题之Loading and Execution加载和运行_javascript技巧

WBOY
Release: 2016-05-16 15:19:10
Original
910 people have browsed it

JavaScript 在浏览器中的性能,可认为是开发者所要面对的最重要的可用性问题。此问题因JavaScript的阻塞特征而复杂,也就是说,当JavaScript 运行时其他的事情不能被浏览器处理。事实上,大多数浏览器使用单进程处理UI 更新和JavaScript 运行等多个任务,而同一时间只能有一个任务被执行。

JavaScript运行了多长时间,那么在浏览器空闲下来响应用户输入之前的等待时间就有多长。

从基本层面说,这意味着

典型的例子是document.write()函数,例如:





Script Example


Copy after login

当浏览器遇到一个

Hello world!

Copy after login

虽然这些代码看起来是无害的,但它们确实存在性能问题:在部分加载了三个JavaScript 文件。因为每个

Hello world!

<– Example of recommended script positioning –>
Copy after login

此代码展示了所推荐的

以上就是关于javascript优化内容中的Loading and Execution加载和运行的相关介绍,希望对大家的学习有所帮助。

Related labels:
source:php.cn
Previous article:AngularJS模块学习之Anchor Scroll_AngularJS Next article:JQuery日历插件My97DatePicker日期范围限制_jquery
Statement of this Website
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
Latest Articles by Author
Latest Issues
Related Topics
More>
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!