HTML [is] in direct competition with other technologies intended for applications deployed over the web, in particular Flash and Silverlight.
[The web] won on desktop, just in time for mobile to eat the world.
Native apps | Web apps | PWAs | |
---|---|---|---|
📶 Offline | ✔ | ❌ | ✔ |
📈 Progressive | ❌ | ✔ | ✔ |
🐙 Multithreaded | ✔ | ❌ | ✔ |
The web platform has always had two solutions to every problem: the deprecated one you shouldn't use and the one that's not yet ready.
Ye olde way | The hot 🔥 new way | |
---|---|---|
Static data | AppCache | Cache API (Service Worker) |
Dynamic/query data | LocalStorage, WebSQL |
IndexedDB |
Smartphones are becoming more pervasise than connectivity. When you have a supercomputer in your pocket, but intermittent connectivity, the ability to work offline is the key to ubiquity.
<html>
<script src="gigantic-app.js"></script>
</html>
// index.js
var worker = new Worker('worker.js');
worker.postMessage('ping');
worker.onmessage = function (e) {
console.log(e.data); // 'pong'
};
// worker.js
self.onmessage = function (e) {
console.log(e.data); // 'ping'
self.postMessage('pong');
};
The gain is pretty marginal... and it just adds a lot of development complexity. This is probably the reason we haven't seen web worker-based rendering architecture widely used in real apps.