Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
window.onload = () => {
let 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>`;
}
window.onload = () => {
let 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>`;
}