From, with love.
Subscribe now

Service Workers

Hi everyone,

One of the toughest things we do as front-end engineers is try to keep up with the onslaught of new standards and features that browsers are implementing. It's difficult to know what you should know about what you shouldn't. Periodically, I'll give you a heads up on some technology you should be looking into, and this time it's service workers.

It's likely you've heard of service workers due to a masterful marketing campaign by the Chrome team, but most of the discussions I see center around creating "offline-first" applications using service workers. While that's a definite possibility, limiting the thinking around service workers to just offline capabilities is missing the larger picture of what service workers do.

In short, service workers are a proxy that ships with the browser. They intercept requests as they come out from the browser and allow you to change what happens as a result of a request. Yes, you could decide to avoid making the request altogether and return content to create an offline experience. But you could also implement your own caching algorithm, only periodically going back to your server; you could disallow certain requests during certain periods of time; you could purposefully bypass the cache based on some heuristic. The possibilities are tremendous.

I don't think it's a stretch to say that service workers could have an impact similar in magnitude to XMLHttpRequest, the feature that began the Ajax revolution in web applications. Both service workers and XMLHttpRequest share the same basic nature: fairly low-level APIs that give developers more control over network requests. It's conceivable that in another couple of years, you won't even think of writing a web application without using service workers to monitor and manage requests between the browser and your server.

I think service workers are still not quite ready to use. There are compatibility issues and lack of browser support to worry about. However, service workers will progress and I think by this time next year we'll all be talking about how to better leverage them in our web applications. Experiment and prototype now if you're interested, but definitely keep an eye on service workers going forward.

Be well.

JavaScript WeeklySponsor: The O’Reilly Fluent Conference
Subscribers receive $200+ off with discount code NCZ20 (expires 11/30)

Recommended Links

Refactoring Module Dependencies (article)
The prolific Martin Fowler describes how to refactor a program (both in Java and JavaScript) into modules. This is a long read but well worth it, as Fowler talks through the various paradigms and design patterns involved in the refactoring. An excellent overview of thinking through your software design to be as loosely-coupled as possible.

“Tomato” versus “#FF6347”—the tragicomic history of CSS color names (article)
If you've ever looked at the named colors in CSS, you might have been confused as to where they could have possibly come up with such strange names for colors. This article digs into the history of CSS named colors, uncovering the roots of a seemingly arbitrary naming convention.

Raiders of the lost Web (article)
Once something is on the web, it's there forever...right? Not necessarily. Links get rotten, servers get taken down, and sometimes, important journalistic pieces disappear without a trace. While the Internet Archive makes a good-faith effort to catalog and backup as many sites as possible, that's often not nearly enough to keep important information from disappearing completely. This article explores what happened to a Pulitzer-finalist series that disappeared from the web.
Interested in sponsoring the newsletter? This space is available! Just reply to this email for more information.

Recommended Book

Imagine you woke up and couldn't move, what would your life be like? That's exactly what happened to Martin Pistorius, who fell as a child and was thought to be brain dead. In Ghost Boy, Martin shares what it was like for him, realizing no one knew he was still inside his body and his extraordinary efforts to change that. Through the use of assistive technology such as a switch and headmouse, Martin slowly regained his ability to communicate and interact with the world. I've never read a story that shows the life-changing potential of accessible technology better than this book.

Recently on NCZOnline

ECMAScript 6 destructuring gotcha
With all of the new syntax in ECMAScript 6, you're bound to periodically find something that is confusing (likely as you're hunting down an error). Recently, I've seen an uptick in the reporting of a specific type of error as it relates to destructuring assignment[1] using object patterns. Destructuring basics Before you can understand the...

Triggering Jenkins builds by URL
As you might have read not too long ago, I recently moved my site from Wordpress to Jekyll[1]. In so doing, I ended up using Jenkins[2] to periodically build and upload my site to S3. Having a Jenkins instance running turns out to be quite useful for all sorts of tasks and so I've been...

My favorite interview question
Interviewing and hiring are more difficult tasks than they may seem. The cost of hiring the wrong person is quite high, yet companies that are hiring often want help sooner rather than later and so sometimes don't want to wait for a good candidate to come along. I operate on the mindset that the damage...


Love this newsletter? Hate it? Have suggestions for how to make it better? When you subscribe to the newsletter, you can just reply to send in feedback.
Copyright © 2015 Nicholas C. Zakas, All rights reserved.

unsubscribe from this list    update subscription preferences