Socket
Socket
Sign inDemoInstall

@helios-interactive/vue-nfc-reader

Package Overview
Dependencies
46
Maintainers
4
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @helios-interactive/vue-nfc-reader

Vue Plugin to interface with the NFC Reader Server


Version published
Weekly downloads
5
increased by400%
Maintainers
4
Created
Weekly downloads
 

Readme

Source

Vue NFC Reader

Vue Plugin to interface with the NFC Reader Server

This plugin requires the NFC Reader Server to be active. (nfc-reader-server-electron)

Installation

# install
npm i -S @helios-interactive/vue-nfc-reader

Usage

To use the CardReader component:

Register Plugin with Vue

import Vue from 'vue';
import NFCRead from '@helios-interactive/vue-nfc-reader';

Vue.use(NFCRead, { host: 'http://localhost', port: 3333 });

This will register the CardReader component with Vue and make it available for use in other components.

The host and port properties are used to set the host and port for the NFC Reader Server.

Use Within a Component

<template>
  <card-reader
    @ready="scannerReady"
    @error="scannerError"
    @uid="handleUid"
    @info="handleInfo"
  />
  <p>STATUS: {{ status }}</p>
  <p>UID: {{ uid }}</p>
  <p>INFO: {{ info }}</p>
</template>

<script>
export default {
  name: 'MyComponent',
  data() {
    return {
      status: '[scanner status]',
      uid: '',
      info: '',
    };
  },
  methods: {
    scannerReady() {
      this.status = 'Ready to scan';
    },
    scannerError(error) {
      this.status = `Error: ${error.message}`;
    },
    handleUid(uid) {
      this.uid = uid;
    },
    handleInfo(data) {
      this.info = data;
    },
  },
};
</script>

The CardReader component emits 4 different events:

  • ready: Event emitted when the app is connected to the server and scanner is ready to scan. Wait for this event to fire before prompting the user to scan.
  • error: Event emitted when an error occurs. This could be a disconnection from the server, or a disconnection of the scanning device. Payload includes a javascript error with a message. NOTE: If an error occurs after the ready event has been fired, ready status should be revoked. ready will fire again if the error resolves itself.
  • uid: Event emitted when a card is successfully scanned. Payload is the UID.
  • info: Event emitted whenever any activity is relayed to the plugin from the server. The payload includes all message info of communication between the plugin and the NFC Reader Server. Not necessary for production, but can be useful for debugging.

FAQs

Last updated on 19 Oct 2018

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc