UNPKG

react-native-filament

Version:

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

30 lines (26 loc) 1.49 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.FilamentWorkletContext = exports.FilamentProxy = void 0; var _FilamentModule = require("./FilamentModule"); var _reactNativeWorkletsCore = require("react-native-worklets-core"); const successful = _FilamentModule.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?'); } const FilamentProxy = exports.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: _reactNativeWorkletsCore.Worklets.defaultContext; // Create our custom RNF worklet context: const FilamentWorkletContext = exports.FilamentWorkletContext = proxy.createWorkletContext(); //# sourceMappingURL=FilamentProxy.js.map