UNPKG

onnxruntime-react-native

Version:
52 lines (43 loc) 1.57 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.jsiHelper = exports.binding = void 0; var _reactNative = require("react-native"); // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. // eslint-disable-next-line @typescript-eslint/no-unused-vars /** * model loading information */ /** * JSIBlob is a blob object that exchange ArrayBuffer by OnnxruntimeJSIHelper. */ /** * Tensor type for react native, which doesn't allow ArrayBuffer in native bridge, so data will be stored as JSIBlob. */ /** * Binding exports a simple synchronized inference session object wrap. */ // export native binding const { Onnxruntime, OnnxruntimeJSIHelper } = _reactNative.NativeModules; const binding = exports.binding = Onnxruntime; // install JSI helper global functions OnnxruntimeJSIHelper.install(); const jsiHelper = exports.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