Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@kuiper/svelte-scan-qrcode

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@kuiper/svelte-scan-qrcode

Scan QR Code on browser by open camera or upload QR Code image. Support open cameras on Android and iOS browsers.

  • 0.0.5
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
4
decreased by-73.33%
Maintainers
1
Weekly downloads
 
Created
Source

svelte-scan-qrcode

Scan QR Code on browser by open camera or upload QR Code image. Support open cameras on Android and iOS browsers.

Demo

How to use
  • Install @kuiper/svelte-scan-qrcode

    npm install --save @kuiper/svelte-scan-qrcode
    
    Simple with bind:scanResult to get scan result
      <script lang="ts">
          import { ScanQRCode } from "@kuiper/svelte-scan-qrcode";
          let result = "";
      </script>
    
      <ScanQRCode bind:scanResult={result} options={{}} />
    
    Custom with enableQRCodeReaderButton and options
      <script lang="ts">
          import { goto } from "$app/navigation";
          import { ScanQRCode } from "@kuiper/svelte-scan-qrcode";
          let result = "";
    
          function _onPermissionError() {
              alert("Permission rejected");
              location.reload();
          }
    
          function _onResulted() {
              if (result.includes("love")) {
                  goto("/result"); // go to result page
              }
          }
      </script>
    
      <ScanQRCode
          bind:scanResult={result}
          enableQRCodeReaderButton={true}
          options={{
              onPermissionError: () => _onPermissionError(),
              onResulted: () => _onResulted(),
          }}
      />
    

  • Props
    • scanResult
      • Type string.
      • Use bind:scanResult to get scan result.
    • enableQRCodeReaderButton
      • Type boolean.
      • Set to true for enable upload QR Code image button. After user uploaded image @kuiper/svelte-scan-qrcode package will read QR Code from image.
    • options
      • Types { onPermissionError?: Function; onResulted?: Function; }
        • onPermissionError function will call if @kuiper/svelte-scan-qrcode package request camera get rejected.
        • onResulted function will call if the @kuiper/svelte-scan-qrcode package gets the scan result from QR Code.

Keywords

FAQs

Package last updated on 09 Oct 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc