flipace / capacitor-codescanner

Capacitor Plugin for Code Scanner

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

@rdlabo/capacitor-codescanner

Capacitor CodeScanner is a native AdMob implementation for iOS. Now, This work at iOS only.

CodeType Web iOS Android
aztec - -
code128 - -
code39 - -
code39Mod43 - -
dataMatrix - -
ean13 - -
ean8 - -
face - -
interleaved2of5 - -
itf14 - -
pdf417 - -
qr - -
upce - -
catBody - -
dogBody - -
humanBody - -
salientObject - -

iOS ScreenShot

DONATE THIS PROJECT

Thanks for considering donate.

If this plugin help you, please share admob income. This help developing this plugin.This also help me easily determine how much time I would spend on the projects each month.

TYPE AMOUNT LINK
PayPal.me Once Any Donate
Paypal Subscription $15/month Donate
Paypal Subscription $30/month Donate
Paypal Subscription $50/month Donate

Installation

$ npm install --save @rdlabo/capacitor-codescanner

How To Use

import { Plugins } from '@capacitor/core';
const { CodeScanner } = Plugins;
import { ScannerOption } from '@rdlabo/capacitor-codescanner';

@Component({
  selector: 'app-root',
  templateUrl: 'app.component.html',
  styleUrls: ['app.component.scss']
})
export class AppComponent implements OnInit {
    constructor(){
        CodeScanner.addListener('CodeScannerCatchEvent', async (info: { code: string }) => {
            console.log(info.code); // Get Code
        });
    }

    openCodeScanner(){
        const option: ScannerOption = {
          detectionX: 0.2,
          detectionY: 0.35,
          detectionWidth: 0.6,
          detectionHeight: 0.15,
        };
        CodeScanner.present(option);
    }
}

APIs

present(): Promise<{ value: boolean }>

CodeScanner.present(ScannerOption);

Event Listener

addListener(eventName: 'CodeScannerCatchEvent', listenerFunc: (info: any) => void): PluginListenerHandle;

Options

ScannerOption

interface AdOptions {
  detectionX?: number;
  detectionY?: number;
  detectionWidth?: number;
  detectionHeight?: number;
  metadataObjectTypes?: Record<
    'aztec' | 'code128' | 'code39' | 'code39Mod43' | 'code93' | 'dataMatrix'
    | 'ean13' | 'ean8' | 'face' | 'interleaved2of5' | 'itf14' | 'pdf417'
    | 'qr' | 'upce' | 'catBody' | 'dogBody' | 'humanBody' | 'salientObject'
    , []>
}

About

Capacitor Plugin for Code Scanner


Languages

Language:Swift 69.2%Language:Java 10.6%Language:TypeScript 8.8%Language:Ruby 5.7%Language:Objective-C 4.1%Language:JavaScript 1.6%