Ever wanted to easily convert an image to a grayscale image on your phone? I do sometimes, and that’s why I build a demo using the Web Share Target API to achieve exactly that.
For this I used the Service Worker way to handle the data. Once the data is received on the client, I use drawImage from canvas to draw the image in canvas, use the grayscale filter to convert it to a grayscale image and output the final image.
So you “install” the little microsite like a PWA, then you natively “share” an image to it and it comes back edited. Clever. Android on Chrome only at the moment.
Reminds me of this “Browser Functions” idea in reverse. That was a server that did things a browser can do, this is a browser doing things a server normally does.
Service Workers are extremely powerful. They are the one technology that can make websites work offline, for example, and have true control over cache. But there is a lot to learn. Fortunately, Frontend Masters has a great course all about them.
The related posts above were algorithmically generated and displayed here without any load on my server at all, thanks to Jetpack.