UNPKG

@techolution-ai/computer-vision

Version:

A JavaScript/TypeScript library for computer vision applications, providing tools for image processing, scanning, and MQTT-based messaging.

40 lines 943 B
// src/scanner/scan-image.tsx import { forwardRef, useEffect, useRef } from "react"; import { jsx } from "react/jsx-runtime"; var ScanImage = forwardRef( (props, ref) => { const { src, crossOrigin, ...restProps } = props; const imageRef = useRef(null); useEffect(() => { const imgRefCopy = imageRef.current; if (imageRef) return; imgRefCopy.src = src; return () => { if (imgRefCopy) { imgRefCopy.src = ""; } }; }, []); return /* @__PURE__ */ jsx( "img", { ref: (_ref) => { imageRef.current = _ref; if (typeof ref === "function") { ref(_ref); } else if (ref) { ; ref.current = _ref; } }, src, ...restProps } ); } ); var scan_image_default = ScanImage; export { scan_image_default as default }; //# sourceMappingURL=scan-image.js.map