Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobg committed Dec 2, 2021
1 parent eeed82f commit 8b78d3a
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 13 deletions.
5 changes: 4 additions & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,8 @@
"no-console": "off",
"strict": ["error", "global"],
"curly": "warn"
}
},
"ignorePatterns": [
"*.min.js"
]
}
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
},
"scripts": {
"build": "webpack",
"lint": "eslint src && eslint tests",
"lint-tests": "eslint tests",
"gen-tests": "npm run build && npm run clean-platform-tests && npm run mkdirp-platform-tests && npm run copy-platform-tests && npm run install-platform-tests",
"clean-platform-tests": "trash ../cordova-plugin-test-projects/cordova-plugin-qrscanner-tests",
Expand Down
10 changes: 4 additions & 6 deletions src/common/src/cordova-remap.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
/* eslint-disable no-redeclare, no-unused-vars */
// This file is generated by `npm run build`.

/*global exports:false*/
/*jshint unused:false */
// remap parameter names from cordova.define
// see `externals` in webpack.cordova.config.js
var cordovaRequire = require;
var cordovaExports = exports;
var cordovaModule = module;
const cordovaRequire = require;
const cordovaExports = exports;
const cordovaModule = module;
6 changes: 3 additions & 3 deletions src/windows/lib/preview.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ function initialize() {
}

function ensurePreviewInitialized() {
if (!_.preview) initialize();
if (!_.preview) { initialize(); }
}

exports.setVideoUrl = function (videoUrl) {
Expand Down Expand Up @@ -73,7 +73,7 @@ exports.resume = function () {
}

exports.isPlaying = function () {
if (!_.preview) return false;
if (!_.preview) { return false; }
return !_.preview.capturePreview.paused;
}

Expand All @@ -85,4 +85,4 @@ exports.destroy = function () {
}
}

module.exports = exports;
module.exports = exports;
10 changes: 7 additions & 3 deletions src/windows/lib/qrScanner.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
/* global cordova, QRReader, WinJS */
/*eslint no-unused-vars: ["error", { "args": "none" }]*/

const preview = require('./preview');
const barcodeReader = new QRReader.Reader();
const VideoCapture = QRReader.VideoCapture;
const Promise = WinJS.Promise;
let availableCameras

const errorTypes = {
UNEXPECTED_ERROR: 0,
Expand Down Expand Up @@ -50,7 +54,7 @@ function resetStatusFlags() {
function reset() {
document.body.removeEventListener('click', onPreviewClick);
preview.destroy();
if (currentVideoCapture) currentVideoCapture.destroy();
if (currentVideoCapture) { currentVideoCapture.destroy(); }
currentVideoCapture = null;
availableCameras = null;
resetStatusFlags();
Expand Down Expand Up @@ -210,7 +214,7 @@ qrScanner.scan = function () {
}

qrScanner.cancelScan = function () {
if (!statusFlags.scanning) return generateStatusResponse();
if (!statusFlags.scanning) { return generateStatusResponse(); }
statusFlags.scanning = false;
barcodeReader.stop();
return generateStatusResponse();
Expand Down Expand Up @@ -282,4 +286,4 @@ for (let property in qrScanner) {

module.exports = exports;

cordova.commandProxy.add("QRScanner", exports);
cordova.commandProxy.add("QRScanner", exports);

0 comments on commit 8b78d3a

Please sign in to comment.