Skip to content

Commit

Permalink
upgrade typescript, fix torch
Browse files Browse the repository at this point in the history
  • Loading branch information
ericblade committed Nov 6, 2022
1 parent b003fbd commit 744be70
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 19 deletions.
39 changes: 26 additions & 13 deletions package-lock.json

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

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ericblade/quagga2",
"version": "1.7.1",
"version": "1.7.7",
"description": "An advanced barcode-scanner written in JavaScript",
"main": "lib/quagga.js",
"types": "type-definitions/quagga.d.ts",
Expand All @@ -24,6 +24,7 @@
"@types/gl-vec2": "^1.3.2",
"@types/lodash": "^4.14.184",
"@types/mocha": "^5.2.7",
"@types/node": "^18.11.9",
"@types/sinon": "^10.0.13",
"@types/sinon-chai": "^3.2.8",
"@typescript-eslint/eslint-plugin": "^5.34.0",
Expand All @@ -50,7 +51,7 @@
"source-map-loader": "^1.1.1",
"ts-mocha": "^10.0.0",
"ts-node": "^10.9.1",
"typescript": "^4.7.4",
"typescript": "^4.9.2-rc",
"webpack": "^4.44.2",
"webpack-cli": "^3.3.12"
},
Expand Down
6 changes: 2 additions & 4 deletions src/input/camera_access.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,17 +137,15 @@ const QuaggaJSCameraAccess: CameraAccessType = {
// TODO: should we acquire camera access even if there's no current camera open?
// TODO: what happens on iOS or another device where torch isn't supported at all? Should we throw an error?
if (track) {
// @ts-ignore // typescript doesn't know the torch property
await track.applyConstraints({ torch: false });
await track.applyConstraints({ advanced: [{ torch: false }] } as MediaTrackConstraintSet);
}
},
async enableTorch() {
const track = getActiveTrack();
// TODO: should we acquire camera access even if there's no current camera open?
// TODO: what happens on iOS or another device where torch isn't supported at all? Should we throw an error?
if (track) {
// @ts-ignore // typescript doesn't know the torch property
await track.applyConstraints({ torch: true });
await track.applyConstraints({ advanced: [{ torch: true }] } as MediaTrackConstraintSet);
}
},
};
Expand Down

0 comments on commit 744be70

Please sign in to comment.