Socket
Book a DemoInstallSign in
Socket

@arriva/wedge

Package Overview
Dependencies
Maintainers
2
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@arriva/wedge

Wedge module will capture data from keyboard wedge readers and send them to a listener function. Essentially all barcode readers, magnetic stripe readers and RFID readers that sends data over keyboard commands and that can be programmed to use start and e

0.2.9
latest
npmnpm
Version published
Weekly downloads
0
Maintainers
2
Weekly downloads
 
Created
Source

Wedge reader for browsers

Wedge module will capture data from keyboard wedge readers and send them to a listener function. Essentially all barcode readers, magnetic stripe readers and RFID readers that sends data over keyboard commands and that can be programmed to use start and end characters can be used.

Installation

npm i @arriva/wedge

Examples

ES6

import wedge from '@arriva/wedge'

let options = {
    // Configuration options
}

let wedge = new Wedge(options)

let eventListener = wedge.listen(function(data){
    console.log([data])
})

eventListener.destroy()

Browser support


<script src="js/wedge.js"></script>
<script>
    var options = {
        // Configuration options
    }

    var wedge = new Wedge(options)

    var instance = wedge.listen(function(data){
        console.log([data])
    })

    instance.destroy()
</script>

Configuration options

When initializing Wedge the following options can be set:

  • escapeStringBegin: Character that starts the code read sequence. (Default: ¤)
  • escapeStringEnd: Character that ends the code read sequence. (Default: ¤)
  • delay: Milliseconds minimum delay between keystrokes to allow read
    var options = {
        escapeStringBegin: '¤',
        escapeStringEnd: '¤',
        delay: 50
    }

    var instance = new Wedge(options)

Methods and properties

Wedge instance

  • Wedge::listen(listenerFunc): Create listener. Listener instance object returned.
  • Wedge::trigger(data): Manually trigger as if data string was read by Wedge.
  • Wedge::purge([listenerId]): Destroy all listeners. Optional [listenerId] will destroy only that listener.

Listener instance

  • Listener::id: Return listener id.
  • Listener::destroy(): Destroy this listener.

Method examples

    var options = {
        escapeStringBegin: '¤',
        escapeStringEnd: '¤',
        delay: 50
    }

    var instance = new Wedge(options)

    var listener1 = instance.listen(function(data){
        console.log(data)
    })
    var listener2 = instance.listen(function(data){
        console.log(data)
    })

    // Trigger all listeners
    instance.trigger('123456789')

    // Purge listener with id
    instance.purge(listener1.id)

    // Purge all listeners
    instance.purge()

Tested units

  • OPTICON NLV-5201 ( https://opticon.com/product/nlv-5201/ )

Conflict situations

If two or more instances of Wedge is launched, listening at same trigger characters, they will interfere and it is unpredictable which listener will catch what characters. Avoid this situation.

Contact information

Contact information will be published later.

FAQs

Package last updated on 16 Apr 2019

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

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.