Norvell's Public Machinations

    jssm-viz

    1.18.2 • Public • Published

    jssm-viz

    Visualization of JSSM machines using viz.js



    TL;DR

    Easy to use fsl to svg through jssm.



    Node

    cd ~/projects && mkdir jssm-viz-demo && cd jssm-viz-demo
    npm init -y && npm install --save-dev jssm-viz

    in dump_svg.js:

    async function run() {
    
      const jssm_viz = require('jssm-viz'),
            fsl_code = 'green => yellow => red => green; [green yellow red] ~> off -> red;';
    
      svg_code = await jssm_viz.fsl_to_svg_string(fsl_code);
    
      console.log(svg_code);
    
    }
    
    run();
    node ./dump_svg.js

    Et voila: svg of your fsl.



    Browser

    <!doctype html><html><head><title>jssm-viz example</title>
        <script defer type="text/javascript" src="jssm-viz.iife.js"></script>
        <script defer type="text/javascript">
    
          window.onload = async () => {
    
            const ExMachine = `
              Green => Yellow => Red => Green;
              [Red Yellow Green] ~> Off -> Red;
            `;
    
            document.getElementById('tgt').innerHTML = await window.jssm_viz.fsl_to_svg_string(ExMachine);
    
          }
    
        </script>
    
      </head>
    
      <body><div id="tgt"></div></body>
    
    </html>

    What is this?

    jssm-viz is a way to render your fsl and jssm to svg (and from there to jpeg and png.)

    See it in use.

    TODO: write a better readme

    Install

    npm i jssm-viz

    DownloadsWeekly Downloads

    33

    Version

    1.18.2

    License

    MIT

    Unpacked Size

    6.91 MB

    Total Files

    15

    Last publish

    Collaborators

    • stonecypher