This is a simple QRScanner using `instascan` and Svelte.
npm install svelte-qr-scannerThis is a simple QRScanner using instascan and Svelte.
Import at your javascript at htmlx (svelte) file:
``js`
import QRScanner from 'svelte-qr-scanner'
In html part:
`html`
No cameras loaded!
* width - Scanner video width.
* height - Scanner video height.
* fit - object-fit strategy (none, contain, fill, scale-down...).
* border - CSS border String. ('3px solid black').
* borderRadius - CSS border radius String. ('5px').
* cameras - List of cameras available.
* opts - instascan opts.
`javascript``
let opts = {
// Whether to scan continuously for QR codes. If false, use scanner.scan() to manually scan.
// If true, the scanner emits the "scan" event when a QR code is scanned. Default true.
continuous: true,
// The HTML element to use for the camera's video preview. Must be a
* scan() - Manually activates scan
* stop() - Stops scanner
* changeCamera(camera) - Changes the current camera, if no paramaters passed it changes to the next available camera.
* scan - Fired when the Scanner reads a QR Code, returns the content as event payload.
* scannerStarted - Fired when scanner has started.
* scannerStopped - Fired when scanner has stopped.
* scannerStartFailed - Fired when scanner start failed.
* loadCameraFailed - Fired when scanner camera has failed.