1. 3
  1.  

  2. 3

    There’s an absolutely brilliant hack in here.

    Part of the goal is to allow existing poorly written third-party scripts - analytics stuff for example - to run in a sandbox in a web worker rather than jamming up the main thread.

    Problem is, those scripts need to access the page DOM API.

    Partytown uses a devious trick where a proxy object provides getters and setters which then make blocking API calls to a separate service worker, using the mostly-forgotten xhr.open(…, false) parameter.

    It’s so clever!