react-native-filament
Version:
A real-time physically based 3D rendering engine for React Native
19 lines (18 loc) • 658 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.useWorkletCallback = useWorkletCallback;
var _reactNativeWorkletsCore = require("react-native-worklets-core");
var _Context = require("../react/Context");
var _ErrorUtils = require("../ErrorUtils");
/**
* Creates a callback that can be executed in he separate worklet thread of the engine.
*/
function useWorkletCallback(callback) {
const {
workletContext
} = (0, _Context.useFilamentContext)();
return (0, _reactNativeWorkletsCore.useWorklet)(workletContext, (0, _ErrorUtils.wrapWithErrorHandler)(callback));
}
//# sourceMappingURL=useWorkletCallback.js.map