Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@builder.io/partytown

Package Overview
Dependencies
Maintainers
18
Versions
80
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@builder.io/partytown

Relocate resource intensive third-party scripts off of the main thread and into a web worker.

  • 0.10.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
265K
decreased by-5.68%
Maintainers
18
Weekly downloads
 
Created

What is @builder.io/partytown?

@builder.io/partytown is a JavaScript library that helps move resource-intensive operations from the main thread to web workers. This can significantly improve the performance of web applications by offloading tasks such as third-party scripts, analytics, and other heavy computations to a background thread.

What are @builder.io/partytown's main functionalities?

Offloading Third-Party Scripts

This feature allows you to offload third-party scripts to web workers, reducing the load on the main thread and improving page performance. The code sample initializes Partytown and forwards specific functions to the web worker.

import { init } from '@builder.io/partytown';

init({
  forward: ['dataLayer.push'],
});

Web Worker Communication

Partytown enables seamless communication between the main thread and web workers. The code sample demonstrates how to forward a custom function to be executed in a web worker.

import { init } from '@builder.io/partytown';

init({
  forward: ['myCustomFunction'],
});

function myCustomFunction() {
  console.log('This runs in a web worker');
}

Improving Performance

By offloading resource-intensive tasks to web workers, Partytown helps improve the overall performance of your web application. The code sample shows how to forward a heavy computation function to a web worker.

import { init } from '@builder.io/partytown';

init({
  forward: ['heavyComputation'],
});

function heavyComputation() {
  // Some resource-intensive task
}

Other packages similar to @builder.io/partytown

Keywords

FAQs

Package last updated on 27 Apr 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc