vue-lynx / runOnMainThread
Function: runOnMainThread()
Mark a function to be executed on the Main Thread.
Returns a wrapper that, when called from the Background Thread, dispatches the call to the Main Thread via the worklet runtime and returns a Promise that resolves to the function's return value.
The SWC worklet transform replaces the fn argument with a worklet context
object at build time. Without the transform, fn is passed through as-is
(dev warning in non-production builds).
Type Parameters
Parameters
Returns
Function
Parameters
Returns
Promise<R>
Example
Defined in
packages/vue-lynx/runtime/src/cross-thread.ts:41