react-native-filament
Version:
A real-time physically based 3D rendering engine for React Native
14 lines (13 loc) • 484 B
JavaScript
import { useWorklet } from 'react-native-worklets-core';
import { useFilamentContext } from '../react/Context';
import { wrapWithErrorHandler } from '../ErrorUtils';
/**
* Creates a callback that can be executed in he separate worklet thread of the engine.
*/
export function useWorkletCallback(callback) {
const {
workletContext
} = useFilamentContext();
return useWorklet(workletContext, wrapWithErrorHandler(callback));
}
//# sourceMappingURL=useWorkletCallback.js.map