jakesgordon / javascript-state-machine

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

Is the data type of the status value not allowed to be int? #191

Open phpstudyone opened 4 years ago

phpstudyone commented 4 years ago

image

The data type of the status value is not allowed to be int?

const StateMachine = require('javascript-state-machine');
var fsm = new StateMachine({
    init: 1,
    transitions: [
      { name: 'melt',     from: 1, to: 2 },
      { name: 'freeze',   from: 2, to:3  },
      { name: 'vaporize', from: 3, to: 4 },
      { name: 'condense', from: 4, to: 5 }
    ],
    methods: {
      onMelt:     function(t) { console.log('I melted',t,this)    },
      onFreeze:   function() { console.log('I froze')     },
      onVaporize: function() { console.log('I vaporized') },
      onCondense: function() { console.log('I condensed') }
    }
});

fsm.melt();
rahulyadav commented 4 years ago

I'm also facing the same issue