2 ms·
Know of any good examples/tutorials of this?
by wnevets 10y ago
Know of any good examples/tutorials of this?
- mbrock 10y agoUnfortunately not, but if you think of it as using the command pattern in a queue-ish way to get a similar behavior as the command queue of "The Sims", you have the basic architecture, and from there it's just a matter of coding. The thing about React-like frameworks that makes it very nice is that you can keep the command queue in a separate place and have a root rendering function like this: 1. Set the view state to a copy of the actual state 2. Update the view state according to each queued command in turn 3. Render the view state including a status bubble showing that some changes are not saved yet And separately from the rendering, you have a worker that tries (and retries) to perform the queued commands. When a command is successfully performed, it's removed from the queue and its effect on the state is saved in the actual state. Since I can't find anything on Google when searching for "react command queue" it would be cool to write a blog post with a simple example, but I don't know when I'd have time, so I encourage anyone who's implemented a similar thing to go ahead.
- ibash 10y agoThis is similar to what I wrote about here: https://blog.superhuman.com/architecting-a-web-app-to-just-work-offline-part-1-8697f316c0eb#.p5tofnlfu https://blog.superhuman.com/architecting-a-web-app-to-just-w...