To use thymus.js it obviously needs to be included in the page. Here is the minimal setup:
<head> <meta charset="utf-8" /> <!-- Thymus script --> <script src="js/thymus.js" id="thymus" data-thx-base-path="."></script> </head>
There are two required thymus.js attributes. The
id/namespace is used to identify the thymus.js script in
order to capture various attribute options on the script tag while
is used for fragment path resolution and attribute path resolution. It should point
to the root context of the application relative to the page in
which thymus.js is loaded.
Internally, when thymus.js loads, it checks for the presence
of the JQuery API. If it's not found it will automatically load
the most current version found at http://code.jquery.com/jquery.min.js.
To provide your own version, simply add the JQuery
tag prior to the thymus.js one or provide a
attribute on the thymus.js
tag that points to the JQuery API of choice.
Once JQuery has successfully loaded thymus.js will attempt to load any fragments by looking for DOM elements that have a siphon attribute or a short-hand version of a siphon attribute assigned to it (see the deferment section to prevent fragments from loading automatically). thymus.js loads fragments using JQuery $.ajax(...) calls to retrieve and insert fragments into the DOM. The process is similar to how JQuery $.load(...) works with page fragments, but also automates and adds DOM event interaction to the process.
thymus.js recognizes two types of fragments. The first being
view fragments. Any fragments retrieved that have a
will be interpreted as a view content. Similarly, fragments
will also be interpreted as view content, but will have
limited model interaction capabilities. Any of the model
identifiers and are interpreted as model content and
updated in corresponding views via model
This site actually uses 0 thymus.js fragment views to initialize this page. So, feel free to explore and check out your browsers console :)