yieldmachine icon indicating copy to clipboard operation
yieldmachine copied to clipboard

Allow states with dynamic elements, e.g. a router

Open RoyalIcing opened this issue 4 years ago • 2 comments

const songID = Symbol();
yield path(['song', songID]);

RoyalIcing avatar Apr 30 '21 11:04 RoyalIcing

Could allow State to be represented a URL or JSON tuple/object. This could turn into support for serialising and deserialising the current state.

RoyalIcing avatar Sep 16 '21 04:09 RoyalIcing

machine.current; // { song: 123 }
musicURLFromState(machine.currentURL); // "/song/123"
machine.jump({ song: 456 });

machine.current; // { song: 456 }
musicURLFromState(machine.currentURL); // "/song/456"
machine.jump(musicStateFromURL("/song/789"));
machine.current; // { song: 789 }

RoyalIcing avatar Sep 16 '21 04:09 RoyalIcing