33 lines
750 B
HTML
33 lines
750 B
HTML
<html>
|
|
<head>
|
|
|
|
<script src="runtime.js"></script>
|
|
<script src="fact.js"></script>
|
|
|
|
<script>
|
|
plt.runtime.invokeMains();
|
|
|
|
plt.runtime.ready(function() {
|
|
var myFactClosure = plt.runtime.lookupInMains('fact');
|
|
var myFact = plt.baselib.functions.asJavaScriptFunction(
|
|
myFactClosure);
|
|
|
|
myFact(function(v) {
|
|
$('#answer').text('computed. Printing...');
|
|
setTimeout(function() { $('#answer').text(v.toString()); }, 0);
|
|
},
|
|
function(err) {
|
|
$('#answer').text(err.message).css("color", "red");
|
|
},
|
|
10000
|
|
// "one-billion-dollars"
|
|
);
|
|
});
|
|
</script>
|
|
</head>
|
|
|
|
<body>
|
|
The factorial of 10000 is <span id="answer">being computed</span>.
|
|
</body>
|
|
</html>
|