layout | title |
---|---|
default |
Documentation / User Guide |
{% capture content %}
This page contains documentation specific to the JavaScript backend. To learn more of the UHC please look at the extensive documentation.
Clone the latest version of the JavaScript branch of UHC. This is somewhat risky but new features will be found here first.
Make sure you have the dependencies, also make sure you have GHC installed:
cabal install uulib uuagc
Now build the UHC:
$> cd somewhere $> git clone git://github.com/UU-ComputerScience/uhc.git $> cd uhc $> git checkout js $> cd EHC $> autoconf $> ./configure $> make uhc
Optionally perform a make install
.
Compiling happens by calling UHC with the -tjs
flag.
uhc -tjs Main.hs
This will compile Main.hs and generate a .js
file for each import you made,
as well as the main module. It will also create a file Main.html
for you that
contains a bare-bone HTML template including the references to the generated
JavaScript code.
If you want the UHC to generate a single JavaScript file you can add the
following parameter: -O,2
. It will enable whole-program optimisation
and output all JavaScript to the file Main.js
.
As we do not yet have full Cabal support we currently resort to makefiles. (If someone wants to convert this to shake, please go ahead!)
COMPILER = $yourpath$ --import-path=$any_libraries_you_use$ -tjs -O,2 all: build build: ${COMPILER} main.hs .PHONY clean: rm `find . -d -name "*.core*"` rm `find . -d -name "*.hi*"`
We offer several bindings to JavaScript, jQuery, and BackBone. They can be found in the UHC-JavaScript library.
This is the list of currently active UHC-JS enabled projects:
{% endcapture %}
<!-- <li><a href="#getting_started">Getting Started</a></li><li><a href="#communicating_with_javascript">Communicating with JavaScript</a></li><li class="active"><a href="#examples__practice">Examples / Practice</a></li> -->
</ul>