The blue square supports drag and drop. Try dragging it over and dropping it into one of the squares.

This demonstrates several simultaneous state machines using generators and recursion to transition from state to state. The draggable object gets its own draggable-object state machine. Each of the droppable areas gets their own instance of the drop-target state machine.

See code below (or even better look at source or devtools)