-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add version 2.2.1 with some refactors to code Change log. ### Version 2.2.1 - Added support for `supportedScanType` in `Html5QrcodeScanner`. This feature was implemented by our latest contributor - [mohsinaav@](https://github.com/mohsinaav) Now users can decide to only use camera based scan or file based scan or use them in different order. How to use: ```js function onScanSuccess(decodedText, decodedResult) { // handle the scanned code as you like, for example: console.log(`Code matched = ${decodedText}`, decodedResult); } let config = { fps: 10, qrbox: {width: 100, height: 100}, rememberLastUsedCamera: true, // Only support camera scan type. supportedScanTypes: [Html5QrcodeScanType.SCAN_TYPE_CAMERA] }; let html5QrcodeScanner = new Html5QrcodeScanner( "reader", config, /* verbose= */ false); html5QrcodeScanner.render(onScanSuccess); ``` For file based scan only choose: ```js supportedScanTypes: [Html5QrcodeScanType.SCAN_TYPE_FILE] ``` For supporting both as it is today, you can ignore this field or set as: ```js supportedScanTypes: [ Html5QrcodeScanType.SCAN_TYPE_CAMERA, Html5QrcodeScanType.SCAN_TYPE_FILE] ``` To set the file based scan as defult change the order: ```js supportedScanTypes: [ Html5QrcodeScanType.SCAN_TYPE_FILE, Html5QrcodeScanType.SCAN_TYPE_CAMERA] ``` * Add test for ScanTypeSelector * Codacy fixes
- Loading branch information
Showing
10 changed files
with
465 additions
and
107 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,3 +4,5 @@ package-lock.json | |
.vscode/ | ||
dist/ | ||
src/*.d.ts | ||
src/*/*.d.ts | ||
src/*/*/*.d.ts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,18 @@ | ||
/** Append the libary components to globals for backwards compatibility. */ | ||
if (window && !Html5QrcodeScanner) { | ||
var Html5QrcodeScanner = window.__Html5QrcodeLibrary__.Html5QrcodeScanner; | ||
var Html5Qrcode = window.__Html5QrcodeLibrary__.Html5Qrcode; | ||
var Html5QrcodeSupportedFormats = window.__Html5QrcodeLibrary__.Html5QrcodeSupportedFormats | ||
var Html5QrcodeScannerState = window.__Html5QrcodeLibrary__.Html5QrcodeScannerState; | ||
var Html5QrcodeScanType = window.__Html5QrcodeLibrary__.Html5QrcodeScanType; | ||
if (window) { | ||
if (!Html5QrcodeScanner) { | ||
var Html5QrcodeScanner = window.__Html5QrcodeLibrary__.Html5QrcodeScanner; | ||
} | ||
if (!Html5Qrcode) { | ||
var Html5Qrcode = window.__Html5QrcodeLibrary__.Html5Qrcode; | ||
} | ||
if (!Html5QrcodeSupportedFormats) { | ||
var Html5QrcodeSupportedFormats = window.__Html5QrcodeLibrary__.Html5QrcodeSupportedFormats | ||
} | ||
if (!Html5QrcodeScannerState) { | ||
var Html5QrcodeScannerState = window.__Html5QrcodeLibrary__.Html5QrcodeScannerState; | ||
} | ||
if (!Html5QrcodeScanType) { | ||
var Html5QrcodeScanType = window.__Html5QrcodeLibrary__.Html5QrcodeScanType; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.