four essential modules to deal with asynchronous functions (technically, it's a
setTimeout), value caching, DOM manipulation and basic functional needs like
composition or object projections.
How to use it in your project
The easiest way to use it in your web projects is to simply package them with
You can follow these
to use it without
If you don't want to or can't use SJW, it's still possible to use UnitJS by generating a single script that can then be loaded from your web page like this :
unit.js can be easily generated with
make, which actually just
unit.js.tpl script. Note that you can still generate custom
«partial» versions of
unit.js if you don't use all of it by overriding the
SRC variable of the
Makefile like so :
make SRC="src/UnitJS/Dom.js src/UnitJS/Cache.js"
or by manually calling
./unit.js.tpl with the files you want, like the
When used that way, the
code as a global variable
unitJS containing each of the modules (
Dom, etc.) as an attribute.