isWorkerRuntime Available from 0.8.0
Checks if the current runtime is a Worker Runtime.
Reference
import {
isWorkerRuntime,
scheduleOnUI,
scheduleOnRuntime,
createWorkletRuntime,
} from 'react-native-worklets';
console.log(isWorkerRuntime()); // false
scheduleOnUI(() => {
console.log(isWorkerRuntime()); // false
})();
const workerRuntime = createWorkletRuntime();
scheduleOnRuntime(workerRuntime, () => {
console.log(isWorkerRuntime()); // true
})();


Type definitions
function isWorkerRuntime(): boolean;
Returns
true if the current runtime is the Worker 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.