Skip to content

Commit

Permalink
feat: export component prop types
Browse files Browse the repository at this point in the history
See: #462 #460
  • Loading branch information
gruhn authored Dec 27, 2024
1 parent 442446a commit cc200c4
Show file tree
Hide file tree
Showing 10 changed files with 220 additions and 58 deletions.
1 change: 1 addition & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ jobs:
VITEPRESS_BASE: /vue-qrcode-reader/
run: |
pnpm install
pnpm run type-check
pnpm run build
pnpm run docs:build
- name: Deploy Docs
Expand Down
9 changes: 5 additions & 4 deletions docs/api/QrcodeStream.md
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ When you unpause the camera is restarted so the `camera-on` event is emitted aga

### `track`

- **Input Type:** `Function`
- **Input Type:** `(codes: DetectedBarcode[], ctx: CanvasRenderingContext2D) => void`
- **Default:** `undefined`

You can visually highlight detected QR codes in real-time.
Expand All @@ -232,12 +232,13 @@ When a QR code is detected, its location is painted to the canvas.

To enable this feature, pass a function to `track` that defines how this should look like.
This function is called to produce each frame.
It receives the location object as the first argument and a `CanvasRenderingContext2D` instance as the second argument.
It receives an array of detected barcodes as the first argument and a `CanvasRenderingContext2D` instance as the second argument.

For example check out [this demo](../demos/FullDemo.md).

Note that this scanning frequency has to be increased.
So if you want to go easy on your target device you might not want to enable tracking.
Note that the scanning frequency is increased when you provide a track function,
which might hurt performance perceptibly.
So if you want to go easy on your target device you might want to keep tracking disabled.

::: danger
Avoid access to reactive properties in this function (like stuff in `data`, `computed` or your Vuex store). The function is called several times a second and might cause memory leaks. To be safe don't access `this` at all.
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
"vite-plugin-dts": "3.6.4",
"vitepress": "1.0.0-rc.32",
"vue": "3.3.13",
"vue-tsc": "1.8.25",
"vue-tsc": "2.1.10",
"workbox-window": "7.0.0"
},
"bugs": "https://github.com/gruhn/vue-qrcode-reader/issues",
Expand Down
Loading

0 comments on commit cc200c4

Please sign in to comment.