Replies: 8 comments 13 replies
-
Could you create the most minimal example? The main limitation is that we only have access to the stdlib and not any anvil module It might not work but it'll be fun trying |
Beta Was this translation helpful? Give feedback.
-
Yes I sure can make a clone. I was about to start building a test app for this anyway so I will do that with the idea to clone that here. |
Beta Was this translation helpful? Give feedback.
-
Ok so I have created a minimal example. The basic premise is that to upload lots of files/images we need a consistent internet connection. If there is no connection when the files are uploaded they should be stored locally until they can be uploaded. The example takes files from a If files are large or there are lots it takes a bit of time (but it doesn't time out since it is using client writable views). If this could be off loaded to a background process via a web worker then the main app can continue relatively unhindered. Ultimately it would be good to extend this functionality to entire table rows but for now being able to upload the files separately would be sufficient. I would be keen to make this work to include in Anvil Extras - something like this would have made my life a whole lot easier 2 years ago Please bear in mind files will be saved to the data tables so please don't upload anything sensitive if using the example link. |
Beta Was this translation helpful? Give feedback.
-
!!!! Its sooooo freaking Awesome!!!! Honestly Stu if you ever need a personal cheerleader - I am there, pompoms and all. Love it - now, how the heck do I use it 😂 So I am presuming we could use this to send anything JSONable right? Thank you for checking this out Stu - even this is immensely helpful so far. |
Beta Was this translation helpful? Give feedback.
-
So I have got this working up to the point of the HTTP endpoint, but I am struggling to convert the request body into a
prints:
I notice in the Chorme Dev tools that looking at the Indexed_DB entry the content is stored as a |
Beta Was this translation helpful? Give feedback.
-
Hope it's ok to ask this here as it's pretty closely related to the discussion and work already done. @s-cork how difficult would it be to use a PWA Service worker background sync for this sort of update? That way the update should be able to cope with a loss of internet and still update even if the app is closed/no longer in foreground or the device is off(asleep) once internet returns. The App I'm developing requires a messaging function so the ability to enter a message when offline click send put the phone back in your pocket and have the message sent once the phone gets a connection is much preferable to only sending once you go back to the app (possibly hours or days later). This would truly make the offline usability of Anvil awesome!! |
Beta Was this translation helpful? Give feedback.
-
@s-cork Are you able to help me adjust the code to send a dict. I have the media working but have not been able to send a dict via http.
I have tried to send it as a string which works but figured there was something I am missing in my understanding of the fetch api. |
Beta Was this translation helpful? Give feedback.
-
It seems that this WebWorker code has now stopped working. Thanks in advance. |
Beta Was this translation helpful? Give feedback.
-
Not that I know anything about web workers but I think I have a use case and would like some guidance on whether I am barking up the right tree or this is in fact a fire hydrant.
I have an app that carries out inspections, large inspections. typically 100 odd questions with 50 or 60 photos to be attached which are temporarily saved to IndexedDB before upload.
The problem we have faced is that uploading that volume of data needs to be done in chunks to avoid time outs and this locks up the app while upload takes place.
Could I use a web worker to handle this in the background leaving the user free to move on to other tasks?
Could I also use the web worker to check whether there is an internet connection before proceeding?
Thanks in advance.
Rick.
Beta Was this translation helpful? Give feedback.
All reactions