Skip to content

Conversation

skusnierz
Copy link
Contributor

@skusnierz skusnierz commented Sep 10, 2025

Summary

This PR :

  • adds runOnRuntimeSync API function
  • adds runOnRuntimeSync type tests and runtime test
  • adds docs for runOnRuntimeSync function

Test plan

Screenshot 2025-09-10 at 16 07 46 Screenshot 2025-09-10 at 16 07 54

@skusnierz skusnierz requested a review from tjzel September 10, 2025 14:08
@skusnierz skusnierz self-assigned this Sep 10, 2025
if (globalThis.__RUNTIME_KIND !== RuntimeKind.ReactNative) {
return WorkletsModule.runOnRuntimeSync(
workletRuntime,
makeShareableCloneOnUIRecursive(() => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why on worker runtime we want to call makeShareableCloneOnUIRecursive? 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an old name, it was created before the functionality of creating custom Worklet Runtimes was added. This function should be called makeShareableCloneOnWorkletRuntimeRecursive, but as we discussed yesterday with @tjzel, we will not change it

Comment on lines +7 to +8
`runOnRuntimeSync` lets you run a [workletized](/docs/fundamentals/glossary#to-workletize) function synchronously on a [Worker Runtime](/docs/fundamentals/glossary#worker-worklet-runtime---worker-runtime).
It might preempt the Runtime where it's called from the thread (it's blocking).
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
`runOnRuntimeSync` lets you run a [workletized](/docs/fundamentals/glossary#to-workletize) function synchronously on a [Worker Runtime](/docs/fundamentals/glossary#worker-worklet-runtime---worker-runtime).
It might preempt the Runtime where it's called from the thread (it's blocking).
`runOnRuntimeSync` lets you run a [workletized](/docs/fundamentals/glossary#to-workletize) function synchronously on a [Worker Runtime](/docs/fundamentals/glossary#worker-worklet-runtime---worker-runtime). It's blocking - meaning that it can preempt the runtime from a thread that's currently executing it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants