Skip to content

[✨] Disable fallback to main thread #669

@elliotdickison

Description

@elliotdickison

Is your feature request related to a problem?

Currently Partytown will fall back to running scripts on the main thread if it can't run them using Atomics or Service Workers (source). This behavior cannot be configured. I have a use-case where I'd like to run low priority scripts in Partytown or not at all (never on the main thread). This is not currently possible.

Describe the solution you'd like

I would love a boolean disableFallback configuration flag that tells Partytown to do nothing instead of falling back to the main thread if it can't run scripts.

Describe alternatives you've considered

I tried setting the fallbackTimeout configuration option to a very large value, but this only affects fallbacks when Partytown fails to initialize for reasons other than compatibility. When Partytown cannot be initialized due to browser compatibility the fallback will run immediately, regardless of the timeout value.

Additional context

It appears that this feature could be accomplished with a couple lines in the Partytown snippet - I am happy to implement this if I can get a thumbs up on my proposed solution.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions