react / runOnMainThread

Function: runOnMainThread()

function runOnMainThread<Fn>(fn: Fn): (...args: Parameters<Fn>) => void

runOnMainThread allows triggering main thread functions on the main thread asynchronously.

Type Parameters

Type Parameter
Fn extends (...args: any[]) => any

Parameters

Parameter Type Description
fn Fn The main thread functions to be called.

Returns

Function

A function. Calling which with the arguments to be passed to the main thread function to trigger it on the main thread.

Parameters

Parameter Type
...args Parameters<Fn>

Returns

void

Defined in

@lynx-js/react/runtime/lib/worklet/runWorklet.d.ts:7

Except as otherwise noted, this work is licensed under a Creative Commons Attribution 4.0 International License, and code samples are licensed under the Apache License 2.0.