@fugood/onnxruntime-react-native
Version:
ONNX Runtime bridge for react native
26 lines (24 loc) • 1.1 kB
JavaScript
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// eslint-disable-next-line @typescript-eslint/no-unused-vars
import { NativeModules } from 'react-native';
import Onnxruntime from './NativeOnnxruntime';
// export native binding
const {
OnnxruntimeJSIHelper
} = NativeModules;
export const binding = Onnxruntime; // install JSI helper global functions
OnnxruntimeJSIHelper.install();
export const jsiHelper = {
storeArrayBuffer: globalThis.jsiOnnxruntimeStoreArrayBuffer || (() => {
throw new Error('jsiOnnxruntimeStoreArrayBuffer is not found, ' + 'please make sure OnnxruntimeJSIHelper installation is successful.');
}),
resolveArrayBuffer: globalThis.jsiOnnxruntimeResolveArrayBuffer || (() => {
throw new Error('jsiOnnxruntimeResolveArrayBuffer is not found, ' + 'please make sure OnnxruntimeJSIHelper installation is successful.');
})
}; // Remove global functions after installation
{
delete globalThis.jsiOnnxruntimeStoreArrayBuffer;
delete globalThis.jsiOnnxruntimeResolveArrayBuffer;
}
//# sourceMappingURL=binding.js.map