Open menteora opened 6 years ago
I don't think there is a library supported method, but I've done:
let machine = StateMachine({
... state setup ...
data: {
firstState: {a: 1},
secondState: {}
},
methods: {
onFirstState: function(lifecycle) {
// logs {a: 1}
console.log(this[lifecycle.to]);
}
}
})
Try using a function -
data: function() { return {
firstState: { a: 1},
secondState: {}
}};
I took your guide that speak about single data shared from all states or passed on initialization, but I don't understand how to define one color for each state, for example.
Thanks You
Guide Reference: http://github.com/jakesgordon/javascript-state-machine/blob/master/docs/data-and-methods.md