Skip to content
This repository has been archived by the owner on Aug 11, 2020. It is now read-only.

Commit

Permalink
[WinJS][Win10] Fixes "formats" in options passed to BarcodeReader.sca…
Browse files Browse the repository at this point in the history
…n() being ignored (#524)

* Fixes "formats" in options passed to BarcodeReader.scan() being ignored by WinJS implementation targeting Windows 10

* Fulfilled pull request requirements
  • Loading branch information
LSBOSS authored and macdonst committed Sep 6, 2017
1 parent f316c4e commit 1f016d9
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/windows/BarcodeScannerProxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,21 @@ BarcodeReader.prototype.init = function (capture, width, height) {
this._height = height;
this._zxingReader = new ZXing.BarcodeReader();
this._zxingReader.tryHarder = true;

var formatsList = BarcodeReader.scanCallArgs.args.length > 0 && BarcodeReader.scanCallArgs.args[0].formats;
if (formatsList) {
var possibleFormats = formatsList
.split(",")
.map(format => {
for (var index in BARCODE_FORMAT) {
if (BARCODE_FORMAT[index] === format) {
return index;
}
}
});

this._zxingReader.possibleFormats = possibleFormats;
}
};

/**
Expand Down

0 comments on commit 1f016d9

Please sign in to comment.