# ngx-scan-detect

> Detects barcode or qr code scanning on document and emits the scanned barcode.

Latest version **2.0.5** (published 2025-02-06) · 0 weekly downloads

## Install

```sh
npm install ngx-scan-detect
pnpm add ngx-scan-detect
yarn add ngx-scan-detect
bun add ngx-scan-detect
```

## Health

**Score 35/100 (D)** — status: maintenance-mode.

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads.

Negative: stale; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.5 |
| Published | 2025-02-06 |
| First published | 2025-02-06 |
| Weekly downloads | 0 |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 18.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | sezmars |
| Keywords | ngx, angular, barcode, scanner, detectet, definition, ngx-barcodeput, scanner parser, scanner-parser, barcode scanner, ngx-scan-detect, barcode-scanner, scanner input definer, scanner-input-definer, barcode scanner parser, barcode-scanner-parser, scanner input recognizer, scanner-input-recognizer, Barcode Scanner Input Detect, barcode scanner input definer, barcode-scanner-input-definer, barcode scanner input recognizer, barcode-scanner-input-recognizer |

## Links

- npm: https://www.npmjs.com/package/ngx-scan-detect
- npm.io page: https://npm.io/package/ngx-scan-detect

## Dependencies (1)

- [tslib](https://npm.io/package/tslib.md) ^2.8.1

## Alternatives

- [jsforce](https://npm.io/package/jsforce.md) — 851.2K weekly downloads
- [react-native-qrcode-svg](https://npm.io/package/react-native-qrcode-svg.md) — 693.5K weekly downloads
- [@salesforce/plugin-data](https://npm.io/package/@salesforce/plugin-data.md) — 394.9K weekly downloads
- [@backstage/plugin-search-common](https://npm.io/package/@backstage/plugin-search-common.md) — 308.5K weekly downloads
- [@chain-registry/types](https://npm.io/package/@chain-registry/types.md) — 38.4K weekly downloads

## Recent versions

- 2.0.5 (latest) — 2025-02-06

## README

# ngx-scan-detect

Detects barcode or qr code scanning on document and emits the scanned barcode.

[![NPM](https://nodei.co/npm/ngx-scan-detect.png?compact=true)](https://nodei.co/npm/ngx-scan-detect/)

**[Demo](https://sezmars.github.io/ngx-scan-detect/)** | <a href="https://github.com/sezmars/ngx-scan-detect/blob/main/demo.mp4" target="_blank">Video Demo</a>

Angular directive for handling input events. Useful for determine input using a barcode-scanner.

Like binding to a regular `type` event in a template, you can do something like this:

```HTML
<input ngxBarCodePut
       (detected)="onDetected($event)">
```


## Installation

```shell
npm install --save ngx-scan-detect
```


## Usage

You can then use the directive in your templates:

```typescript
@Component({
  selector: 'app-ngx-scan-detect',
  templateUrl: './ngx-scan-detect.component.html',
  styleUrls: ['./ngx-scan-detect.component.scss'],
  standalone: true,
  imports: [CommonModule, NgxBarCodePutDirective],
})

export class AppComponent {
  public onDetected(event: IDetect) {
    console.info(event); 
    /* {event: KeyboardEvent, value: "sezmars", time: 0.07083499999716878, type: "scanner"} */
    /* {event: KeyboardEvent, value: "3333333", time: 0.17083499999716878, type: "keyboard"} */
  }

  public onDelete(event: IDelete) {
    console.info(event);
    /* {event: KeyboardEvent, value: "3333333", type: "delete"} */
  }
}
```

### Options

| Property name | Type   | Default | Description                                                                                                                                    |
|---------------|--------| ------ |------------------------------------------------------------------------------------------------------------------------------------------------|
| `debounce`    | number | `0` | This property is necessary for scenarios such as type-ahead where the rate of user input must be controlled.                                   |
| `workMode`    | string | `manual` | This property controls the automatic clearing of the input field.                                                                              |
| `skipStart`   | number | `0` | Allows you to ignore the first values of the length of the input data. The search begins after entering the first character if the value is 0. |
| `detected`    | event  | `empty` | Returns object with keyboard event, input value, data entry time and device type: ` keyboard or scanner`.                                      |
| `delete`      | event  | `empty` | Returns an object with input value, keyboard event, and type.                                                                                  |

---
_Source: https://npm.io/package/ngx-scan-detect · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
