Add wake-lock
closes #412
Afaik the service worker is in a different thread than the webpage. So if we would add it, it would stop the service worker's thread from going to sleep and not the webpage's one. But I'm not sure, correct me if I'm wrong.
Afaik the service worker is in a different thread than the webpage. So if we would add it, it would stop the service worker's thread from going to sleep and not the webpage's one. But I'm not sure, correct me if I'm wrong.
Sorry about my bad explain. I intended that the service worker, actually, is caching about all resources of the page (like all scripts, see code below) after the first load (and, so, service work install), in this way, when you load Snapdrop, it loads from a local saved (and cached) resource that permits a faster page load. I just was suggesting to add also this resource, too, so, the user can experience a faster Snapdrop.
P.S.: to explain me more, let me saying this... I didn't intended to add the script into the service worker but just add it's file entry, as other files below. I don't know if I'm explaining...
https://github.com/RobinLinus/snapdrop/blob/bd3d13d48a754121b53aa91034579466937ff2e3/client/service-worker.js#L1-L12
@RobinLinus Could you take a look at this PR please?
Have you tested your code? It does not work for me. The Documentation reads:
This function call must be wrapped in a user input event handler e.g. a mouse or touch handler
I guess you would have to call it on click / touch events. That would mean, only the sending part could successfully enable this with the current implementation. I plan to change this with #560
@schlagmichdoch If I remember correctly it worked for me on Android using Firefox, Brave and Chrome
@Myzel394 I tested on iOS only, but nice that it works on Android! After putting it in a click handler it is now working on iOS as well 🦾
@schlagmichdoch yes iOS is always a pain in the ass. Could you show how you added the click handler? I'm personally not going to spend any time on Apple. Wenn du anders denkst, na dann schlag mich doch :D
Very good, seems like @RobinLinus isn't maintaining this project anymore, so I'd suggest to move over to your implementation instead.