jakesgordon / javascript-state-machine

A javascript finite state machine library
MIT License
8.69k stars 964 forks source link

Add states mask for from condition: NOT #111

Open reeshkov opened 7 years ago

reeshkov commented 7 years ago

For example:

    var fsm = StateMachine.create({
    initial: 'hungry',
    events: [
          { name: 'eat',     from: 'hungry',    to: 'satisfied' },
          { name: 'eat',     from: 'satisfied',  to: 'full'      },
          { name: 'eat',     from: 'full',            to: 'sick'      },
          { name: 'rest',    from: '*',               to: 'hungry'    },
          { name: 'work',  from: '~thirst',     to: 'thirst'      },
          { name: 'drink',  from: 'thirst',        to: 'satisfied'      },
     ]});
jakesgordon commented 7 years ago

That's an interesting idea, I'll keep that in mind for a future feature.