Web
Service Workers, the future for caching
This week I got the opportunity to experiment with the Service Worker API at work, in a lab session held by @OskarKarlsson. Although it is not supported in all browsers just yet, my initial impressions are pretty much that I love it.
It feels a lot like what I would expect Application Cache to be but without the quirks. Not only can we use it as a “Cache Everything” solution, with service workers we’re also able to priorities how we want to read from the cache as well.
Making (JavaScript) Promises
When writing JavaScript code you often, if not always, end up writing something that is asynchronous. Whether it’s responding to File I/O, a AJAX request using or user interaction the standard method have been to use
callback functions
. Writing a function that use callbacks can look something like the followingIt's not Application Cache's Fault.. Sometimes.
At work we are currently building a mobile web application together with a client. We decided that we would a good idea to use Application Cache for offline mode as well as handling updates when we release new versions of the site.
It’s been a long road and I kind of knew that we would hit roadblocks. But I never thought that they would just keep on coming.