When you load MathJax.js
into a web page, it configures itself and
immediately begins loading the components it needs. As MathJax starts
up, it uses its signaling mechanism
to indicate the actions that it is taking so that MathJax extensions
can tie into the initialization process, and so other applications
within the page can synchronize their actions with MathJax.
The startup process performs the following actions:
MathJax
variable, and defines the following
subsystems:MathJax.Object
(object-oriented programming model)MathJax.Callback
(callbacks, signals, and queues)MathJax.Ajax
(file-loading and style-creation code)MathJax.HTML
(support code for creating HTML elements)MathJax.Message
(manages the menu line in the lower left)MathJax.Hub
(the core MathJax functions)MathJax.InputJax
,
MathJax.OutputJax
, and MathJax.ElementJax
objects.<script>
tag that loaded the MathJax.js
file, and sets the MathJax.Hub.config.root
value to reflect the
location of the MathJax root directory.MathJax.Hub.Browser
object, which includes the browser
name and version, plus isMac
, isPC
, isMSIE
, and so on.MathJax.Hub.queue
command queue, and
populates it with the commands MathJax runs at startup. This
includes creating the MathJax.Hub.Startup.onload
onload
handler that is used to synchronize MathJax’s action with the
loading of the page.Once the MathJax.Hub.queue
is created, the following actions are
pushed into the queue:
Begin
startup signalBegin Config
startup signalconfig=
as a script parameter<script>
that loaded MathJax, if it is not emptydelayStartupUntil
condition to be met, if one was specifiedtext/x-mathjax-config
script blocksMathJax.Hub.config.config
arrayEnd Config
startup signalBegin Cookie
startup signalEnd Cookie
startup signalBegin Styles
startup signalMathJax.Hub.config.stylesheets
arrayMathJax.Hub.config.styles
End Styles
startup signalBegin Jax
startup signalMathJax.Hub.config.jax
arrayEnd Jax
startup signalBegin Extensions
startup signalMathJax.Hub.config.extensions
array[name] Ready
or Extension
[name] Ready
startup message when they are loaded (where
[name]
is the name of the extension)End Extensions
startup signalDOMContentLoaded
event rather than the page’s
onload
event, so processing of mathematics can start earlier)MathJax.isReady
to true
Begin Typeset
startup signalBegin PreProcess
hub signalEnd PreProcess
hub signalBegin Process
hub signalMath
action is
starting (with a parameter indicating what action that is),
Begin
and End Math Input
messages, and Begin
and
End Math Output
signals.New Math
hub signal
with the math element’s IDEnd Process
hub signalEnd Typeset
startup signalEnd
startup signalThe loading of the jax and extensions in steps 5 and 6 are now done in parallel, rather than sequentially. That is, all the jax and extensions are requested simultaneously, so they load concurrently. That means they can load in any order, and that the begin and end signals for the jax and extensions can be intermixed. (In general, you will get Begin Jax followed by Begin Extensions, but the order of End Jax and End Extensions will depend on the files being loaded.) Both 5 and 6 must complete, however, before 7 will be performed.
See the test/sample-signals.html file to see the signals in action.