matches API
matthewp opened this issue · comments
Matthew Phillips commented
This is something I've been experimenting with in a personal project. It would work something like this:
import {
createMachine,
invoke,
state,
state as final,
transition
} from 'robot3';
machine = createMachine({
idle: state(
transition('next', 'upload')
),
upload: invoke(createMachine({
one: state(transition('next', 'done'))
done: final()
}), transition('done', 'idle')
})
service.matches('idle'); // true
service.send('next');
service.matches('idle'); // false
service.matches('upload.one'); // true
Matthew Phillips commented
Oops! I forgot about #56