UNPKG

1.08 kBTypeScriptView Raw
1import type { WorkletFunction } from './commonTypes';
2export type WorkletRuntime = {
3 __hostObjectWorkletRuntime: never;
4 readonly name: string;
5};
6/**
7 * Lets you create a new JS runtime which can be used to run worklets possibly
8 * on different threads than JS or UI thread.
9 *
10 * @param name - A name used to identify the runtime which will appear in
11 * devices list in Chrome DevTools.
12 * @param initializer - An optional worklet that will be run synchronously on
13 * the same thread immediately after the runtime is created.
14 * @returns WorkletRuntime which is a
15 * `jsi::HostObject<reanimated::WorkletRuntime>` - {@link WorkletRuntime}
16 * @see https://docs.swmansion.com/react-native-reanimated/docs/threading/createWorkletRuntime
17 */
18export declare function createWorkletRuntime(name: string, initializer?: () => void): WorkletRuntime;
19export declare function runOnRuntime<Args extends unknown[], ReturnValue>(workletRuntime: WorkletRuntime, worklet: (...args: Args) => ReturnValue): WorkletFunction<Args, ReturnValue>;
20//# sourceMappingURL=runtimes.d.ts.map
\No newline at end of file