Your Browser is Pooped: A Real-World Application of Using Web Workers to Create a 100% Browser-Based Barcode Scanner
The browser is exhausted. Megabytes of scripts are run simultaneously to power our JS libraries and frameworks to order products, talk with our friends, and watch videos. Much of these processes are handled on the main thread, because modern browsers these days are built to operate at Mach 8. But we must ask ourselves the question… why? Why do we enjoy beating the UI thread into submission?
Call it a lack of understanding, or good real-world examples, or whatever. We need to give the main thread a break.
In this talk we’re going to look an extremely practical use case for leveraging web workers to give our browser a chance to breathe and do what it’s best at doing: displaying stuff. We’re going to dive deep into the concepts related to async worker processing and thread communication. We’ll build a 100% web-based barcode scanner and test it using real devices. We’ll talk about browser garbage collection, and use some browser based tools to evaluate memory usage.
Believe me, your browser — and your end user — will love you for it.