随笔分类 - XState
摘要:Unbeknownst to many, promises are state machines. They exist in either an idle, pending, resolved or rejected state. Because they can be modeled as st
阅读全文
摘要:The passing of time can be represented as an event in XState. Rather than requiring the user to send an event after an amount of time has passed, XSta
阅读全文
只有注册用户登录后才能阅读该文。
只有注册用户登录后才能阅读该文。
摘要:Can you walk and talk at the same time? If so, you've experienced what it's like to be in two states at the same time. Hopefully, those two states hav
阅读全文
摘要:As our state machines grow more complex, we might find ourselves in a situation where a state should only exist if the machine is already in another s
阅读全文
摘要:Not all transitions should be taken immediately. Occasionally, we would like to conditionally take a transition. We do this through the use of "guards
阅读全文
摘要:Activities are continuous, ongoing side effects that are triggered by entering a particular state, and only stop when that state is exited. In the exa
阅读全文
摘要:Consider a text input. It would be impossible for anyone to model every value you could possibly put into it, because the number of possible values is
阅读全文
摘要:XState provides the send function to create an action that will send the event passed in to the machine. If we provide the second argument to the send
阅读全文
摘要:Transitions come in two varieties: "external" and "internal". By default, a transition is considered external. This means that a transition will exit
阅读全文
只有注册用户登录后才能阅读该文。
只有注册用户登录后才能阅读该文。
摘要:While it's powerful enough to have Machine.transition, it can get tedious constantly passing it a state and an event. It would be nice if we had a fun
阅读全文
摘要:numerating the possible states of a function is a sound way to write a function, but it is imperative and could benefit from abstraction. We can do th
阅读全文