← Sessions

Your Browser is Pooped: A Real-World Application of Using Web Workers to Create a 100% Browser-Based Barcode Scanner

JavaScript-heavy applications have taken over the planet. In the span of 10-15 years, we’ve gone from using JavaScript to animate a few actions on our websites, to powering the largest social networks that touch almost every aspect of this world. Much has been regarded about the power of JavaScript and the versatility of the language, but in these conversations we always neglect to mention our friend: the browser.

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.

Drew DeCarme
UI/UX Solution/Front-End Architect, Engineer, and Node Dependency Hater; Front-End Software Consultant, Chariot Solutions