UNPKG

react-native-filament

Version:

A real-time physically based 3D rendering engine for React Native

24 lines (21 loc) 1.24 kB
import { FilamentModule } from './FilamentModule'; import { Worklets } from 'react-native-worklets-core'; const successful = FilamentModule.install(); if (!successful) { throw new Error('Failed to initialize react-native-filament! The install() method returned false - check the native logs (adb logcat or Xcode logs) for more information.'); } // @ts-expect-error global is untyped, it's a C++ host-object const proxy = global.FilamentProxy; if (proxy == null) { throw new Error('Failed to initialize react-native-filament. The global proxy instance (global.FilamentProxy) is null. Check the native logs (adb logcat or Xcode logs) for more information.'); } if (!proxy.hasWorklets) { throw new Error('Failed to initialize react-native-filament - Worklets are not available (HAS_WORKLETS=false), did you install react-native-worklets-core?'); } export const FilamentProxy = proxy; // We must make sure that the Worklets API (module) is initialized (as its possible a lazy-loaded CxxTurboModule), // to initialize we must only call any property of the module: Worklets.defaultContext; // Create our custom RNF worklet context: export const FilamentWorkletContext = proxy.createWorkletContext(); //# sourceMappingURL=FilamentProxy.js.map