Skip to content

Commit

Permalink
NEW method isScanInProgressFor()
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrej Kabachnik committed May 1, 2020
1 parent c6f43a0 commit e9782f5
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ Note: there are more callbacks in the options, than event types. The non-event c
| setOptions | DOMElement, oOptions | Removes all scanner detection logic from the given DOM element. |
| getOptions | DOMElement | Removes all scanner detection logic from the given DOM element. |
| decodeKeyEvent | Event | Extracts the scanned string character from a keyboard event (i.e. `keydown`) |
| isScanInProgressFor | DOMElement | Returns `true` the scanner is currently in the middle of a scan sequence and `false` otherwise. Technically, this means, that the scan sequence started (e.g. via prefix character) and has not ended yet (e.g. via suffix or timeout). This method is usefull inside event handlers. |

## Decoding key codes

Expand Down
10 changes: 10 additions & 0 deletions onscan.js
Original file line number Diff line number Diff line change
Expand Up @@ -496,6 +496,16 @@
this.scannerDetectionData.vars.longPressed = false;
}
return;
},

/**
* Returns TRUE the scanner is currently in the middle of a scan sequence.
*
* @param DomElement
* @return boolean
*/
isScanInProgressFor: function(oDomElement) {
return oDomElement['scannerDetectionData'].vars.firstCharTime > 0;
}
};

Expand Down
4 changes: 2 additions & 2 deletions onscan.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit e9782f5

Please sign in to comment.