The underlying Web Worker API has been available to web developers for almost a decade, but it hasn’t seen widespread adoption. One of the reasons was that the primary API for manipulating web pages, the DOM, was not available inside of workers. WorkerDOM changes this, thereby enabling developers to more easily port their existing applications. We hope that this will spur renewed interest in multi-threaded programming on the web, and lead to much better experiences for users down the road.
WorkerDOM aims to provide a full representation of the DOM inside of Web Workers. In the ideal case this means that scripts can be used unchanged inside of the worker environment. At the heart of the library is an efficient transport mechanism written in TypeScript. It hydrates server rendered DOM and then proxies mutations as an application makes changes to the page, such as reacting to user actions or running animations. For more details about the inner workings of the WorkerDOM library and possible use cases, please check out the slides from our presentation at JSConf US 2018.
Today’s release is an alpha release. WorkerDOM is ready for experimentation but not yet ready for widespread production use. We’d love to collaborate with framework and tool authors to ensure compatibility and great developer experience when using WorkerDOM in as many places and contexts as possible!
Kristofer Baxter, Software Engineer at Google