Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is a "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?

like image 924
Abdullah Khan Avatar asked Aug 13 '10 19:08

Abdullah Khan


2 Answers

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.

like image 183
Adam Lassek Avatar answered Sep 27 '22 18:09

Adam Lassek


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.

like image 28
cweider Avatar answered Sep 27 '22 19:09

cweider