什么是“Javascript 引导加载程序”?
我主要在Facebook的源代码中看到过这个 Bootloader.setResourceMap({"bMxb7":{"name":....
javascript中的bootloader到底是什么?它的用途和目的是什么?
I have seen this mainly in the source of Facebook Bootloader.setResourceMap({"bMxb7":{"name":....
What is exactly a bootloader in javascript? What is its use and purpose?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
Bootloader 是 Facebook 前端代码的重要组成部分,它允许 Javascript 库根据需要延迟加载,而不是在页面加载。如果您愿意,一些 Facebook 开发人员在此了解更多详细信息了解更多。
您可以使用 RequireJS、LABjs 或 其他来实现同样的事情。
Bootloader is an important part of Facebook's front-end code, which allows Javascript libraries to be lazy-loaded as needed instead of on page load. A couple of Facebook developers go into further detail here if you'd like to know more.
You can use RequireJS, LABjs or others to achieve the same thing.
一般来说,引导加载程序是一段(相对)少量的代码,负责建立所有后续代码运行所需的环境,因此它也是最先执行的代码。它通常仅限于操作系统,但对于 FB 也有意义。
就 Facebook 而言,除了开发人员在文档中包含的单个公共
之外,引导加载程序还将执行诸如加载库所需的附加 JS 文件和其他资源之类的操作。
Generally speaking, the bootloader is a (relatively) small amount of code responsible for establishing the environment that all subsequent code requires to run, as such it is also the the first code to be executed. It's usually restricted to OSes, but makes sense for FB too.
In the case of Facebook, the bootloader will do things like loading additional JS files and other resources that the library needs in addition to the single public
<script />
the developer included in the document.严格来说,不存在这样的事情。
引导加载程序(这是该术语的全称)是操作系统的一部分,它从磁盘加载磁盘操作系统,因此计算机通过引导程序自行提升,在加载磁盘加载例程之前从磁盘加载。
没有 Javascript 操作系统,因此没有 Javascript 的引导加载程序。这只是一个以这种方式命名的对象,大概是因为它在页面加载过程的早期做了一些事情。
Strictly speaking, there is no such thing.
A bootstrap loader (which is the full name of the term) is the part of an operating system that loads the disk operating system from disk, thus the computer lifts itself by the bootstraps, by loading from disk before the disk loading routines are loaded.
There are no Javascript operating systems, so there is no bootstrap loader for Javascript. This is just some object that is named that way, presumably because it does something early in the page load process.
这是来自 React.js Conf 2016 的视频,介绍了 Bootloader 是什么。但总而言之:引导加载程序有助于提高应用程序的性能,但不会下载内容,除非确实需要。该视频包含“分享按钮”
https://youtu.be/SnAq9tbeRm4?t=17m16s< /a>
Here is a video from React.js Conf 2016 that touches on what Bootloader is. But to summarize: Bootloader helps improve the performance of the app but not downloading content unless they are actually needed. The video has the example of the 'share button'
https://youtu.be/SnAq9tbeRm4?t=17m16s