diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index eae2733..1fc4317 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,8 +17,8 @@ jobs: build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - uses: actions/setup-node@v2 + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 with: node-version: 18 diff --git a/.github/workflows/npmpublish.yml b/.github/workflows/npmpublish.yml index e9525d5..6e1cad9 100644 --- a/.github/workflows/npmpublish.yml +++ b/.github/workflows/npmpublish.yml @@ -11,8 +11,8 @@ jobs: build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - uses: actions/setup-node@v2 + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 with: node-version: 18 @@ -58,7 +58,7 @@ jobs: with: name: pack-artifact - - uses: actions/setup-node@v2 + - uses: actions/setup-node@v3 with: node-version: 18 registry-url: https://registry.npmjs.org/ diff --git a/package.json b/package.json index 2537a99..8263954 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@zxing/browser", - "version": "0.1.4", + "version": "0.1.5", "description": "ZXing for JS's browser layer.", "keywords": [ "reader", @@ -62,7 +62,7 @@ "devDependencies": { "@rollup/plugin-node-resolve": "^13.1.3", "@types/chai": "^4.3.0", - "@zxing/library": "^0.20.0", + "@zxing/library": "^0.21.0", "chai": "^4.3.6", "cypress": "^9.4.1", "eslint": "^8.8.0", diff --git a/src/readers/BrowserCodeReader.ts b/src/readers/BrowserCodeReader.ts index fc0cb82..cde8297 100644 --- a/src/readers/BrowserCodeReader.ts +++ b/src/readers/BrowserCodeReader.ts @@ -1032,13 +1032,13 @@ export class BrowserCodeReader { /** * The HTML canvas element context. */ - let captureCanvasContext; + let captureCanvasContext: any; try { - captureCanvasContext = elem.getContext('2d', { willReadFrequently: true }) as CanvasRenderingContext2D; + captureCanvasContext = captureCanvas.getContext('2d', { willReadFrequently: true }) as CanvasRenderingContext2D; } catch (e) { - captureCanvasContext = elem.getContext('2d'); + captureCanvasContext = captureCanvas.getContext('2d'); } - + // cannot proceed w/o this if (!captureCanvasContext) { throw new Error('Couldn\'t create canvas for visual element scan.'); diff --git a/yarn.lock b/yarn.lock index 0dd813a..49c0159 100644 --- a/yarn.lock +++ b/yarn.lock @@ -282,10 +282,10 @@ dependencies: "@types/node" "*" -"@zxing/library@^0.20.0": - version "0.20.0" - resolved "https://registry.yarnpkg.com/@zxing/library/-/library-0.20.0.tgz#11bc411b87693015389555c589da61532879be7b" - integrity sha512-6Ev6rcqVjMakZFIDvbUf0dtpPGeZMTfyxYg4HkVWioWeN7cRcnUWT3bU6sdohc82O1nPXcjq6WiGfXX2Pnit6A== +"@zxing/library@^0.21.0": + version "0.21.0" + resolved "https://registry.yarnpkg.com/@zxing/library/-/library-0.21.0.tgz#f20377c394f7023d11a740697cc57dd70b49eaa9" + integrity sha512-2+DFYM6NLl+ZXXUbDOkmVn4TAAOgTniEx5MJD2kStujcxSl6j9CfAgIT8DcsBYIlT5DW7oeiShEzWZjpL0hNOw== dependencies: ts-custom-error "^3.2.1" optionalDependencies: