summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/framework/barcode_events.js
AgeCommit message (Collapse)Author
2015-07-30[REF] web: move barcode_events to module barcodesArthur Maniet
If the module barcodes is installed, a BarcodeEvents singleton is automatically instanciated. It listens to keypresses and, when a sequence of keys represents a barcode, it broadcasts a 'barcode_scanned' event on core.bus containing the barcode string.
2015-05-29[FIX] barcode_events: set parent to WebClient during creationJoren Van Onder
2015-05-29[IMP] barcode_events: dedicated variables to customize barcode detectionJoren Van Onder
2015-05-29[IMP] barcode_events: deal with special keys in FirefoxJoren Van Onder
Let arrow keys, tab and escape pass through. We still want users to be able to use eg. arrow keys to be used when selecting a radio item. This will always work in Chrom{e,ium} because they do not dispatch keypress events for these types of keys, only keydown/keyup events. Firefox does dispatch keypress events. This makes sure that we do not touch those types of events in Firefox. devices have to fire keypresses every 50ms minimum Previously this was 100ms. This works just as well, but was mainly in there for testing purposes.
2015-05-29[IMP] barcode_events: implement better keyrepeat blockingJoren Van Onder
Before this, users were only able to press a key when all other keys were released to prevent a key from repeating. This works but when typing you usually press the next key before releasing the current one. This allows users to do exactly that while still blocking keys from repeating.
2015-05-29[IMP] barcode_events: implement a new way of dealing with barcode eventsJoren Van Onder
Implement a new way of dealing with barcode events. This was necessary because the old way of dealing with input coming from barcode devices did not stop keyevents. This lead to all kinds of issues (eg. barcode reader output being inserted as tender in a paymentline). This new class inserts itself so that it handles all keyevents before everything else. This means that it has authority on what keypress events pass and which ones do not. It differentiates between 'real' keyboard input and input coming from devices by buffering events. When a certain amount of events come in fast enough, it is handled as a barcode and a 'barcode_scanned' event is emitted on core.bus. When buffered events are decided to not be a barcode, they are recreated and redispatched.