Using a script tag
The easiest way to use sUTL in your browser-based Javascript code is via a script tag, like this:
<script type="text/javascript" src="https://emlynoregan.github.io/sUTLHaxeJS/sUTL.js"></script>
If you want to grab a copy of this file to include in your own source, the repo is here:
https://github.com/emlynoregan/sUTLHaxeJS
Here's an example that you can save in an html file and open on your machine:
<html>
<head>
<script type="text/javascript" src="https://emlynoregan.github.io/sUTLHaxeJS/sUTL.js"></script>
</head>
<body>
<h1 id="title">sUTL Hello World</h1>
<input type="submit" id="byBtn" value="Go" onclick="go()"/>
<p id="result" />
<script>
function go (){
var s = new Sutl();
var result = s.evaluate(
"Hello World!!",
["&+", "sUTL says ", "^@"],
{}
);
var resultElem = document.getElementById('result');
resultElem.innerHTML = result;
}
</script>
</body>
</html>
You can play with this code in jsfiddle, here:
npm package
Coming soon...