-
Notifications
You must be signed in to change notification settings - Fork 21
/
index.html
38 lines (25 loc) · 1.64 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<!doctype html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="./style.css" />
<style type="text/css">
h1 { margin: 0; padding: 0 0 1em 0; font-size: 150%; }
html, body { margin: 0; padding: 0; border: 0; }
body { padding: 2em; line-height: 135%; }
code { font-size: 120%; padding: 0 0.25em; background-color: #eee; }
kbd { font-size: 115%; padding: 0 0.25em; background-color: #ddd; }
</style>
<script defer type="text/javascript" src="../../build/jssm.es5.cjs.js"></script>
<script defer type="text/javascript">
/* eslint-disable */
let jssm, sm;
window.onload = () => {
jssm = require('jssm');
sm = jssm.sm;
document.body.innerHTML = `<h1>Ready</h1><p>JSSM has now been loaded at version ${jssm.version}, and is bound to the global <code>jssm</code> (aka <code>window.jssm</code>.) Also, the state machine template string tag is exposed as <code>sm</code> (aka <code>window.sm</code>).</p><p>Please open a console and type something like</p><p><code>var traffic_light = sm<b>\` off -> red => green => yellow => red; [red yellow green] ~> off; \`</b>;</code></p><p>Now you have a working state machine to play with:</p><pre>> traffic_light.state();\n"off"\n\n> traffic_light.transition("green");\nfalse\n\n> traffic_light.state();\n"off"\n\n> traffic_light.transition("red");\ntrue\n\n> traffic_light.state();\n"red"</pre><p>Consoles are <kbd>f12</kbd> on Windows and Linux PCs, or <kbd>command-option-j</kbd> on Macs.</p>`;
}
/* eslint-enable */
</script>
</head>
<body>Loading…</body>
</html>