JSSM, a JavaScript state machine - the FSM for FSL
    Preparing search index...

    Function deserialize

    • Deserializes a previously serialized machine state.

      This function recreates a machine from a serialization object, restoring its state, data, and history. For security and compatibility reasons, it will refuse to deserialize data from future versions of the library.

      Type Parameters

      • mDT

        The type of the machine data member

      Parameters

      • machine_string: string

        The FSL string defining the machine structure

      • ser: JssmSerialization<mDT>

        The serialization object to restore from

      Returns Machine<mDT>

      • The restored machine instance

      If the serialization is from a future version

      import { from, deserialize } from 'jssm';
      const machine = from("a -> b;");
      const serialized = machine.serialize();
      const restored = deserialize("a -> b;", serialized);
      restored.state(); // => 'a'