-
Notifications
You must be signed in to change notification settings - Fork 214
Montage Bootstrapping
This document will describe the bootstrapping process for Montage.
After some setup exports.initMontage
is called. This calls getPlatform
which returns an object with platform specific functions (currently the browser and node are supported).
platform.bootstrap
which really kicks off the browser process. The parameters are retrieved from the data-
attributes of the script tag that loads montage.js
. A "resolve" function is also created that will return an absolute path from a given relative path, using the location of the document as the base. This is implemented by using <base>
and <a>
elements, and using the interaction of these elements in the browser to do the actual resolution.
Next we add a listener for DOMContentLoaded
.
Montage needs 3 files for further bootstrapping: require.js
and browser.js
from Mr to set up the CommonJS module system in the browser and q.js
to add support for promises. These are loaded by injecting script tags. We know when they are loaded because each of the files call a global bootstrap
function with their id and a function that returns their exports when ready.
The global bootstrap
function keeps track of the 3 files and once all three have loaded calls the allModulesLoaded
function.
To do.