isWorkletRuntime
Available from 0.8.0
Checks if the current runtime is a Worklet Runtime, either the UI Runtime or a Worker Runtime.
Reference
Code
Code
Colours connect each executing thread to its current code line. Recently executed lines fade over the next three ticks.
function checkUI() {
'worklet';
console.log(isWorkletRuntime()); // true (UI Runtime)
}
function checkWorker() {
'worklet';
console.log(isWorkletRuntime()); // true (Worker Runtime)
}
console.log(isWorkletRuntime()); // false (RN Runtime)
scheduleOnUI(checkUI);
const workerRuntime = createWorkletRuntime({ name: 'background' });
scheduleOnRuntime(workerRuntime, checkWorker);
Console 0
No output yet
Output appears here as the code runs.


Type definitions
function isWorkletRuntime(): boolean;
Returns
true if the current runtime is a Worklet Runtime, false otherwise.
Remarks
- The function checks the value of
globalThis.__RUNTIME_KINDto determine the kind of the current runtime. See getRuntimeKind for more details.