3 ms·
Thanks for the pointers! Great to see someone actually understands my requirements. I'm already using the <input type="file"> method to load a file into the ap
by nuclx 9y ago
Thanks for the pointers! Great to see someone actually understands my requirements.
I'm already using the <input type="file"> method to load a file into the app. For the saving/download part I tried dynamically generating the output JSON and putting it in the DOM [0], but I don't like that this method doesn't allow to open a Save As dialog with right click. Always rendering the link to the DOM as in [1] crippled the performance of my app, since the link got rerendered on each keypress.
Offline browser applications are definitely appealing, since they're so trivial to update. I think I will dig into LocalStorage, React Router - not sure if I really need IndexedDB, but it definitely sounds interesting too. What I'm missing is comprehensive literature or articles concerning this type of applications. They came to my attention through cryptocurrency websites like MyEtherwallet and EtherDelta.
[0] https://stackoverflow.com/a/18197341 https://stackoverflow.com/a/18197341
[1] https://stackoverflow.com/a/3665147 https://stackoverflow.com/a/3665147
- lioeters 9y agoI've used a similar solution/workaround to create a data URL blob for saving files from a web app. I agree it's not ideal and quite limited. If it were an Electron app, there's an API for opening native file dialogs [0]. As for rendering an updated download link on every keypress - I remember I had to solve it by using a "dummy" download button: when it's clicked, it generates a fresh URL blob to replace the link href, then trigger another click event to start the download. I forget exactly how/if that worked. A couple of months ago I came across remoteStorage, "an open protocol for per-user storage on the Web" [1]. I have not implemented it, but the main idea seems to be "offline-first" apps that keep the user's data local, then sync if/when online. There's also "progressive web apps" [2], to promote this kind of offline-first approach and leveraging local storage. [0] https://electronjs.org/docs/api/dialog https://electronjs.org/docs/api/dialog [1] https://remotestorage.io/ https://remotestorage.io/ [2] https://developers.google.com/web/progressive-web-apps/ https://developers.google.com/web/progressive-web-apps/
- nuclx 9y agoI would love to see Chrome/Firefox embrace the unhosted approach a bit more, but security concerns are certainly a hindrance when it comes to empowering web apps.