Skip to content

Enhancement: Integration with signalslot? #23

@sjlongland

Description

@sjlongland

Just a thought, is it worth providing some integration into signalslot so the events generated by the state machine are exported to other objects as "signals"? I've been managing this by hand in my own code, and found it a very powerful way to interact with Fysom.

It could be an optional feature turned on by specifying what events you want signals created for in the constructor. e.g.

fsm = Fysom({ 'initial': 'green',
          'events': [
              {'name': 'warn', 'src': 'green', 'dst': 'yellow'},
              {'name': 'panic', 'src': 'yellow', 'dst': 'red'},
              {'name': 'calm', 'src': 'red', 'dst': 'yellow'},
              {'name': 'clear', 'src': 'yellow', 'dst': 'green'} ],
          'signals': ['onentergreen','onenteryellow','onenterred', ...]})

The signals could be properties with _sig appended to the name to avoid confusion.

signalslot is here: https://github.com/Numergy/signalslot

If there's interest I might look into implementing it proper.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions