npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

socketmobile-capturejs

v1.3.50

Published

Socket Mobile Capture JS NPM package for Socket Mobile barcode scanner and NFC Reader/Writer products

Downloads

1,889

Readme

socketmobile-capturejs 1.3.50

This Javascript NPM package can be used to add CaptureJS to your Javascript application.

NOTE: If your application is a react-native application please use react-native-capture package which has some native code to make CaptureJS working in iOS and Android.

Usage

Add the CaptureJS in your Node project:

npm i socketmobile-capturejs --save

Using CaptureJS in the code:

import { Capture } from 'socketmobile-capturejs';
import React from 'react';

Devices compatibility and CaptureSDK versions

| Devices | < 1.3 | 1.3 | | :--------------------------------------------: | :---: | :-: | | SocketCam C820 | ❌ | ❌ | | S720/D720/S820 | ❌ | ✅ | | D600, S550, and all other barcode scanners | ✅ | ✅ |

Use with Next.js

For use with Next.js, you will likely receive the below error.

XmlHttpRequest Error

This is because XmlHttpRequest is not available server-side. We are working on more concise solution but for now you can use the below workaround to use captureJs in a Next.js project.

First, you need to install next-transpile-modules and you need to add the below code in your next.config.js.

const withTM = require("next-transpile-modules")(["socketmobile-capturejs"]);
module.exports = withTM({
  webpack5: false,
  //your other exports
});

After that, you will need to install the xhr2 package which will enable you to use XMLHttpRequest server side. Then you will need to add this code into your root file (ex: _app.js).

// hack for "next build"
import xhr2 from "xhr2";
import '../styles/globals.css'

// if SSR is working now, replace XMLHttpRequest with lib
if (typeof globalThis.window?.document?.createElement === 'undefined') {
  globalThis.XMLHttpRequest = xhr2;
}

Then in your pages or index.js file you can import socketmobile-capture modules. Note: You cannot import socketmobile-capture modules in the same file that you write the above global check or you will get the same undefined XMLHttpRequest error. For more on this type of error, check out the issue raised here.

Help

The online documentation is available here: https://docs.socketmobile.com/capturejs/en/latest/