-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
feat(Worklets): runOnRuntimeSync
#8224
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
if (globalThis.__RUNTIME_KIND !== RuntimeKind.ReactNative) { | ||
return WorkletsModule.runOnRuntimeSync( | ||
workletRuntime, | ||
makeShareableCloneOnUIRecursive(() => { |
There was a problem hiding this comment.
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
? 🤔
There was a problem hiding this comment.
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
...ommon-app/src/apps/reanimated/examples/RuntimeTests/tests/runtimes/runOnRuntimeSync.test.tsx
Show resolved
Hide resolved
...ommon-app/src/apps/reanimated/examples/RuntimeTests/tests/runtimes/runOnRuntimeSync.test.tsx
Show resolved
Hide resolved
...ommon-app/src/apps/reanimated/examples/RuntimeTests/tests/runtimes/runOnRuntimeSync.test.tsx
Outdated
Show resolved
Hide resolved
packages/react-native-worklets/Common/cpp/worklets/WorkletRuntime/WorkletRuntime.h
Outdated
Show resolved
Hide resolved
packages/react-native-worklets/Common/cpp/worklets/WorkletRuntime/WorkletRuntime.cpp
Outdated
Show resolved
Hide resolved
`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). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
`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. |
Summary
This PR :
runOnRuntimeSync
API functionrunOnRuntimeSync
type tests and runtime testrunOnRuntimeSync
functionTest plan