jakesgordon / javascript-state-machine

A javascript finite state machine library

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

.can(transition) doesn't work as expected.

elsid139 opened this issue · comments

An element of transitions: [] is as below:
{name: 'deleteRec', from: ['idle', 'deleting', 'renaming'], to: function(s) {return s; }},
I call the transition in the state of 'idle' as below, but the condition always returns false!
if (fsm.can('deleteRec')) {

So I have to use if (['idle', 'deleting', 'renaming'].includes(fsm.state)) {