eonarheim / TypeState

A strongly typed finite state machine for TypeScript
http://eonarheim.github.io/TypeState/example/
BSD 2-Clause "Simplified" License
269 stars 28 forks source link

[Feature] Add verbose logging to FSMs #4

Open eonarheim opened 9 years ago

eonarheim commented 9 years ago

It would be nice to see a description in the console of the reasoning behind transitions for complicated state machines.

dafanasiev commented 6 years ago

You can add Graphviz export (web ui: http://www.webgraphviz.com/) function:

      public asGraphviz() : string {
          const rv = ['digraph G {'];
          this._transitionFunctions.forEach(tf => {
              rv.push(tf.from + ' -> ' + tf.to);
          })
          rv.push('}');
          return rv.join("\n");
      }

Maybe it help...