ServiceWorker is a douchebag

Arthur Stolyar
3 min readApr 11, 2016

--

I thought everyone knows this already, but turns out not. ServiceWorker is a douchebag, it’s too complex, it’s too low-level, it gives too much power to Web Developers.

First, let’s recall the Great Application Cache. This is truly, lovely API which everyone Web Developer deserves. I remember old days when Web wasn’t such complex, when you were able to write couple lines of code, include jQuery and browser would do all other things for you. This was idea world, until… someone said:

Web is not ready. We must make it better. Web should match Native Mobile. Let’s call it Web Manifesto.

Such a stupid idea. And yet, all browsers started moving into that direction, pretending Web Developers need it. They made WebGL, Web Audio API, WebRTC, Web Notifications.. who counts? And hell, they even made a new version of JavaScript. Who needs it anyway?

I thought this cannot be worse, but they tricked us and made this, bloody ServiceWorker. They were trying to do it for years.. Who knows, 3? 5? Or maybe it was 11 years cooperation with Ryan Reynolds to fuck the world with Deadpool and ServiceWorker?

Now, stupid browsers like Firefox are removing Application Cache. Oh my, I thought I’ll throw my monitor to a window. Remember, ServiceWorker isn’t a replacement for Application Cache, it’s too low-level and powerful.

So they ruined offline capability for Web Apps. I could understand if they made something more high-level than Application Cache, something easier to use, something with more abstraction. This way everyone Web Developer like myself could just copy-past its code from MDN and go to the next project. Wouldn’t it be better?

Imagine now, all those ServiceWorker libraries popping around and claiming better performance, intellectual caching, working with CDNs and many other awful things. Hell, I can even imagine some silly people using Cache API and fetch() as asynchronous key-value storage. What they where thinking? I use localStorage for years and it works like a charm. I still remember them deprecating synchronous XHR requests, this broke me directly into heart. I use it on every single site I built and now I have to move to something else. They just do not care about developers earning money in their browsers.

I still believe in ServiceWorker going away, it’s now supported only in 2 major browsers which own 70% of market share on Desktop and 50% in general. This is not enough to take Bulletproof Application Cache away, which was with us for many years, showed solid security, zero bugs and great interoperability. ServiceWorker cannot be replacement for Application Cache, it’s too powerful and very low-level for that. Remember.

Sorry, I couldn’t put less irony into this post, it’s too hard. But I tried. Really.

While you are here, go and try my silly offline-plugin for webpack. Unfortunately it has support of ServiceWorker, so you may not like it.

--

--

Arthur Stolyar

JavaScript, Front-end and Progressive Web Apps developer, Author of `offline-plugin` for webpack: https://github.com/NekR/offline-plugin