scheduleOnRuntime
scheduleOnRuntime lets you schedule a worklet to be executed on a Worker Runtime.
Reference
import { scheduleOnRuntime, createWorkletRuntime } from 'react-native-worklets';
const workletRuntime = createWorkletRuntime({ name: 'background' });
scheduleOnRuntime(workletRuntime, (greeting: string) => {
console.log(`${greeting} from the background Worklet Runtime`);
}, 'Hello');


Type definitions
function scheduleOnRuntime<Args extends unknown[], ReturnValue>(
workletRuntime: WorkletRuntime,
worklet: (...args: Args) => ReturnValue,
...args: Args
): void;
Arguments
workletRuntime
The worklet runtime to schedule the worklet on.
worklet
A reference to a function you want to execute on the Worker Runtime.
args
Arguments to the function you want to execute on the Worker Runtime.
Remarks
- The worklet is scheduled on the Worker Runtime's Async Queue
Call table
| Bundle Mode | RN Runtime | UI Runtime | Worker Runtime |
|---|---|---|---|
| Enabled | ✅ | ✅ | ✅ |
| Disabled | ✅ | ✅ | ✅ |
Platform compatibility
| Native | Web |
|---|---|
| ✅ | ❌ |