react-native-honeywell
Version:
A barcode reader for Honeywell handheld devices
41 lines (39 loc) • 1.51 kB
JavaScript
;
import { NativeEventEmitter, Platform } from 'react-native';
import HoneywellBarcodeReader from "./NativeHoneywell.js";
const barcodeReaderEmitter = new NativeEventEmitter(HoneywellBarcodeReader);
// Get constants from the native module
const constants = HoneywellBarcodeReader.getConstants?.() || {};
const HoneywellBarcodeReaderModule = {
...HoneywellBarcodeReader,
startReader: async () => {
return await HoneywellBarcodeReader.startReader();
},
stopReader: async () => {
return await HoneywellBarcodeReader.stopReader();
},
setReaderProperty: (propName, value) => {
if (typeof value === 'string') {
HoneywellBarcodeReader.setReaderPropertyString(propName, value);
} else if (typeof value === 'number') {
HoneywellBarcodeReader.setReaderPropertyNumber(propName, value);
} else if (typeof value === 'boolean') {
HoneywellBarcodeReader.setReaderPropertyBoolean(propName, value);
}
},
onBarcodeReadSuccess: handler => {
barcodeReaderEmitter.addListener(constants.BARCODE_READ_SUCCESS || 'barcodeReadSuccess', handler);
},
onBarcodeReadFail: handler => {
barcodeReaderEmitter.addListener(constants.BARCODE_READ_FAIL || 'barcodeReadFail', handler);
},
isCompatible: () => {
return Platform.OS === 'android' && HoneywellBarcodeReader.isCompatible();
},
getBrand: () => {
return constants.BRAND;
},
getConstants: () => constants
};
export default HoneywellBarcodeReaderModule;
//# sourceMappingURL=index.js.map