JSFiddle - React, Tailwind, and code Playground

by rgullhaug

HTML

<h3>BarcodeReader API Demo</h3>
    <label for="readerSelect">Readers:</label>
    <select id="readerSelect">
        <option value="None">Select a reader</option>
    </select>
    <br>
    <input type="button" value="Open Reader" id="openButton" onclick="openButtonClicked()" />
    <input type="button" value="Close Reader" id="closeButton" onclick="closeButtonClicked()" disabled /><br>
    <input type="button" value="Activate Reader" id="activateButton" onclick="activateButtonClicked()" disabled />
    <input type="button" value="Deactivate Reader" id="deactivateButton" onclick="deactivateButtonClicked()" disabled />
    <input type="button" value="Remove Listener" id="addEventListenerButton" onclick="addEventListenerButtonClicked()" disabled />
    <input type="button" value="Disable Trigger" id="enableTriggerButton" onclick="enableTriggerButtonClicked()" disabled />
    <input type="button" value="Clear log" id="clearLogButton" onclick="clearLogButtonClicked()" />
    <div>
        <b>Barcode Data Read</b><br>
        <label for="BarcodeData">Data:</label><input type="text" id="BarcodeData" size=20 /><br>
        <label for="SymbType">Symbology:</label><input type="text" id="SymbType" size=16 /><br>
        <label for="ReadTime">Time:</label><input type="text" id="ReadTime" size=24 /><br>
    </div>
    <div><b>Log:</b></div>
    <div id="logMsg">
    </div>

JavaScript

var HoneywellBarcodeReaderUtils={BRIDGE_TYPE_AJAX:"AJAX",BRIDGE_TYPE_NATIVE_WINRT_OBJECT:"NativeWinRTObject",BRIDGE_TYPE_NPAPI:"NPAPI",BRIDGE_TYPE_NONE:"None",DECODER_TYPE_SWIFT:"Swift",DECODER_TYPE_INTERMEC:"In2Decode",MSG_OPERATION_COMPLETED:"Operation completed successfully.",embedNode:null,bridgeType:null,bcrPlugin:null,barcodeReaderObjName:null,checkNpapiPlugin:function(){if(!this.embedNode)try{this.embedNode=document.createElement("embed"),this.embedNode.setAttribute("id","bcrPlugin"),this.embedNode.setAttribute("width",
"0"),this.embedNode.setAttribute("height","0"),this.embedNode.setAttribute("type","application/x-npBarcodeReaderPlugin"),document.body.appendChild(this.embedNode),this.bcrPlugin=document.getElementById("bcrPlugin"),this.bcrPlugin.ITCLogString("Found bcrPlugin element"),this.bridgeType=this.BRIDGE_TYPE_NPAPI}catch(a){return!1}return!0},convertScannerSettingValue:function(a,d,e){var g=!1;if(e&&this.hasProperty(a,"valueType",!0))if("map"===a.valueType)if(this.hasProperty(a,"reverseValueMap",!0)&&a.reverseValueMap instanceof
Array){for(var c,h=0,b=a.reverseValueMap.length;h<b;h++)for(var l in a.reverseValueMap[h])if(l===d){e.value=a.reverseValueMap[h][l];g=!0;break}else"*"===l&&(c=a.reverseValueMap[h][l]);g||"undefined"===typeof c||(e.value=c,g=!0)}else{if(this.hasProperty(a,"valueMap",!0)&&a.valueMap instanceof Array)for(h=0,b=a.valueMap.length;h<b;h++)for(l in a.valueMap[h])if(a.valueMap[h][l]===d){e.value=l;g=!0;break}}else"int"===a.valueType?(e.value=d.toString(),g=!0):"string"===typeof d&&(e.value=d,g=!0);return g},
getRandomInt:function(a,d){return Math.floor(Math.random()*(d-a+1))+a},getSettingDef:function(a,d,e,g,c,h){var b={},l=!1;b.status=0;b.message=this.MSG_OPERATION_COMPLETED;b.family=d;b.key=e;b.option=g;if(a&&a instanceof Array){for(var n=0,m=a.length;n<m&&0===b.status;n++){var...