3 ms·
> I'm thinking that my simplest option is to just write a single page of JS that writes HTML to the DOM directly and works with data entirely locally, synchroni
by pault 8y ago
> I'm thinking that my simplest option is to just write a single page of JS that writes HTML to the DOM directly and works with data entirely locally, synchronizing it with a server API (.NET) when available.
I don't know what your requirements are, but you've just described an SPA framework. Do you think it will be easier to implement your own instead of using something like vue or react? Also, localStorage is supported by all browsers and all you need to do is de/serialize your data to JSON when your data changes.
- crooked-v 8y agoMy thoughts given that outline would be: - Redux with a middleware that saves the whole state to localstorage automatically - Some simple background timer stuff that uses ononline and onoffline events to know when to poll for updates, then dumps the JSON contents from the polling into the Redux store - Some React components that act as one-way output of the stuff in the Redux store, optionally with a basic routing lib if some menus/navigation are necessary Then stick some Progresssive Web App stuff in there so the whole bundle can work offline entirely from browser cache.
- AnIdiotOnTheNet 8y ago> Redux with a middleware that saves the whole state to localstorage automatically I don't want to save the whole state automatically. The state isn't complicated. Even the data isn't complicated. > Some React components that act as one-way output of the stuff in the Redux store, optionally with a basic routing lib if some menus/navigation are necessary Or I just write some javascript that creates a view of based on the data it has cached locally and updates that view when the user interacts with it. This is what we're talking about. I have a relatively simple problem, I don't need to pull in additional dependencies in the form of a framework that's just going to make things more complicated and require me to learn its paradigms.
- crooked-v 8y ago> I don't want to save the whole state automatically. The state isn't complicated. Even the data isn't complicated. If you don't want to save the state, why mention localstorage in the first place? The point of using the Redux thing would be to automate that process, so that you don't have to manually save/retrieve anything to localstorage yourself.