menu

Statecharts

Statecharts are a precise, visual way of modeling the behaviour of complex reactive systems. They describe how things work, and can help you get your code doing exactly what you want.

Channels
Team
Posts
Chat
Members
Info
down-caret

Typestate Guard

Playground What is Typestate? Typestate programming is a pattern for enforcing run-time order of operations at compile-time. In State Machine term, this make it impossible for sending an event that doesn't transition to any state when specific state is active. Most of the time…

thumbsup
2
message-simple
0

Initialising a state machine in a specific state in xState and React

I have a form and I want to load it up in the state it was last used in. I can store the last used state in a database. I'm using @xstate/react, is there a way to pass in a state to useMachine(stateMachine); for it to initialise in ? Has anyone found a way to do this?

thumbsup
1
message-simple
2

Generic Back event that always goes back to the previous state.

I'm trying to implement this for my chatbot. Any one done this before?

thumbsup
0
message-simple
2

Statecharts Description Language (looking for feedback)

Hai everyone! I've been lurking for a while trying to find the right time for introduction and seems like this is the right time. Currently I'm working on a description language to define State Machine. I start from out of curiosity on how to define state machine in Rust which…

thumbsup
4
message-simple
3

Update context from an activity?

Is is possible to update the machines context from inside an activity: Below is a simple example just for illustration. const toggleMachine = Machine( …

thumbsup
0
message-simple
4

Is there a way to "initialize" context on an interpreted machine

For example: const [state, send] = useService(Service.withContext({...});

thumbsup
0
message-simple
1

How to model a simple switch case statement like below?

case 'APPLE' check and case 'ORANGE' check need not be done sequentially. But default state is chosen, only when neither are evaluated to true

thumbsup
1
message-simple
2

installing xstate

I am an embedded programmer and I use state machines to model my code. I have been playing with xstate and the visualizer and found this really useful. I would like to install this on my local webserver so that I can share state machines designs with outer team members. I have…

thumbsup
1
message-simple
1

How to model a bouncing ball? (or: patterns for simulating physics)

I'm trying to create a game using statecharts, but I'm not sure if I'm on the right track regarding modeling the animation/physics. Let's say I want to model a bouncing ball: then natually its state can be either "in_air" or "bouncing"(when it touches the floor). In my design,…

thumbsup
3
message-simple
2

Extracting Keys from a Machine reliably (with TS tools)

I'm trying to separate the machine from a React component that sends events that will be handled by it. I.e. a machine with OPEN, CLOSE events is not used in the component that gets a send function and sends those OPEN, CLOSE events (unlike useMachine from @xstate/react that…

thumbsup
2
message-simple
0