In the previous assignment, I worked for CipherLab , a manufacturer of barcode scanners.
About barcode scanners
First of all, you need to clarify that this is not the scanner itself, but a slow one, but rather an application that reads it. The performance of the scanner itself is somewhat dependent on the price. If you have an inexpensive scanner, it can be slower, the cost of a good scanner will increase productivity as well as adaptability (the ability to read damaged / blurry / dirty barcodes). FYI, most mobile scanners do not have autofocus, as suggested by @Hazzit, but have a fixed, pre-focused lens that is optimized for a specific range of distances. If it is an image scanner (not a laser), scan the scanner by the barcode very close and pull it back until the scanner reads. End users quickly remember the “sweet spot” if they scan tons of barcodes. The laser scanner will only read 1D barcodes, but could potentially be faster and able to choose from a wider range of distances.
About your js code
It seems that the scanner plugin runs synchronously (blocks JS until it receives a barcode). Is there another feature in this library that will allow asynchronous use of the scanner? If not, look at another SDK to see if anyone else allows the asynchronous use of a barcode scanner.
Probably somewhat minor, but I will try to separate your JS DOM manipulation from the scanner code. DOM manipulation is potentially slow depending on the structure of the DOM, your selectors, and what you are doing.
If you can access the scanner asynchronously, you can disable them and do all your DOM manipulations “whenever possible” if the scanner does not block, waiting for the next barcode (basically, updating the user interface after you initiate the scanner, to accept the following barcode).
About scanning a keyboard wedge
Now, keyboard-wedge-style scanners obviously deliver data as quickly as they type, regardless of whether the application is ready for them or can keep up with keystrokes. It will be fast, but there will be no application level control.
You can make the Bluetooth barcode scanner work as a HID device (in fact, a “keyboard wedge” in modern technology), and it will work exactly as described above. Fast, there is still no control of the application level at the hardware level.
Of course, many of these bluetooth libraries also support the bluetooth profile for the SPP serial port, which gives you application level control. You can send commands / scanner configuration, and then read the scanned data.
It uses SDK tools. They simply read / write to the bluetooth serial port (scanner) to poll scanned barcodes. This can be very fast, but it will depend on the quality of the SDK. I am not an iOS programmer and I don’t know anything about this particular platform, but I know that on Windows these are high-level serial port access methods and low-level methods that are much more efficient.
At the same time, you still have the opportunity to return to keyboard cling if you want! Just thought I'd say that.
Also in this wedge keyboard mode, the scanner data prefix using a keyboard shortcut is usually used. Most scanners can insert some additional keystrokes at the beginning or end of the scanned data. For example, you can configure the scanner to type F3+{barcode data}+Enter and view the page for this shortcut, move the focus to the correct input field and then accept the data.
If all else fails
If everything else fails and you just can't get the performance you need ... the only way is to write your own iOS app. Although the high-level tools are great, you will never get the performance of your own application no matter what (for hardware access or user interface performance).