Use a guarded transition and context
to prevent the #box
from being dragged more than 5 times.
- Start with inline assign action objects created from
assign(...)
. - Refactor these ouside the machine.
- Set these as configurable actions in
options.actions
.
- Listen for
keyup
events on the body. WhenEscape
is pressed, we should cancel dragging and reset the box to its original position. Where would this transition go?