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 🙏

© 2026 – Pkg Stats / Ryan Hefner

nexgo-webview-sdk

v1.0.2

Published

TypeScript SDK for Nexgo device APIs (Printer, Scanner, Pinpad, Beeper)

Readme

nexgo-sdk

TypeScript SDK for Nexgo device APIs including Printer, Scanner, Pinpad, and Beeper.

Installation

npm install nexgo-sdk

Features

  • 🎯 Framework-agnostic core - Use with any JavaScript framework or vanilla JS
  • ⚛️ React hooks - Optional React-specific hooks for easy integration
  • 📦 TypeScript support - Full type definitions included
  • 🌲 Tree-shakeable - Import only what you need
  • 🔌 Modular - Use individual devices or the complete SDK

Usage

Vanilla JavaScript / TypeScript

import { NexgoSDK } from 'nexgo-sdk';

// Initialize the SDK
const nexgo = new NexgoSDK();

// Check device availability
console.log(nexgo.getAvailability());
// { printer: true, scanner: true, pinpad: true, beeper: true }

// Use the printer
nexgo.printer.initPrinter();
nexgo.printer.appendPrnStr('Hello World', 24, AlignEnum.CENTER);
nexgo.printer.startPrint();

// Use the scanner
nexgo.scanner.onScan((result) => {
  console.log('Scanned:', result.data);
});
nexgo.scanner.startScan();

// Use the beeper
nexgo.beeper.success(); // Quick success beep

Use Individual Devices

import { NexgoPrinter, NexgoScanner } from 'nexgo-sdk';

const printer = new NexgoPrinter();
const scanner = new NexgoScanner();

if (printer.isAvailable()) {
  printer.initPrinter();
  // ... use printer
}

React Hooks

import { useNexgo } from 'nexgo-sdk/react';
import { AlignEnum } from 'nexgo-sdk';

function MyComponent() {
  const { printer, scanner, beeper, isReady, availability } = useNexgo();

  const handlePrint = () => {
    if (!printer.isReady) return;
  
    printer.printer.initPrinter();
    printer.printer.appendPrnStr('Receipt', 32, AlignEnum.CENTER, true);
    printer.printer.appendPrnStr('Item 1', 24, AlignEnum.LEFT);
    printer.printer.feedPaper(2);
    printer.printer.startPrint();
  
    beeper.success(); // Success beep
  };

  const handleScan = () => {
    if (!scanner.isReady) return;
    scanner.startScan({ timeout: 30000 });
  };

  // Access scan results
  useEffect(() => {
    if (scanner.lastScan?.success) {
      console.log('Scanned:', scanner.lastScan.data);
      beeper.notification();
    }
  }, [scanner.lastScan]);

  return (
    <div>
      <button onClick={handlePrint} disabled={!printer.isReady}>
        Print
      </button>
      <button onClick={handleScan} disabled={!scanner.isReady}>
        Scan
      </button>
    </div>
  );
}

Individual React Hooks

import { usePrinter, useScanner, useBeeper } from 'nexgo-sdk/react';

function PrintComponent() {
  const { printer, isReady, error } = usePrinter();
  
  if (error) return <div>Error: {error}</div>;
  if (!isReady) return <div>Printer not available</div>;
  
  // Use printer...
}

API Reference

Core Classes

NexgoSDK

Main SDK class providing access to all devices.

const nexgo = new NexgoSDK();

// Properties
nexgo.printer: NexgoPrinter
nexgo.scanner: NexgoScanner
nexgo.pinpad: NexgoPinpad
nexgo.beeper: NexgoBeeper

// Methods
nexgo.isFullyAvailable(): boolean
nexgo.getAvailability(): { printer: boolean, scanner: boolean, ... }
nexgo.initAll(): { printer: SdkResult, scanner: SdkResult, ... }

NexgoPrinter

const printer = new NexgoPrinter();

// Initialization
printer.initPrinter(): SdkResult
printer.getStatus(): SdkResult

// Printing
printer.appendPrnStr(text, fontSize, align, bold?): SdkResult
printer.appendImage(bitmap, align): SdkResult
printer.appendBarcode(content, width, height, textPos, format, align, showHri?): SdkResult
printer.appendQRcode(content, size, align): SdkResult

// Configuration
printer.setLetterSpacing(spacing): void
printer.setGray(level): void

// Control
printer.feedPaper(lines): void
printer.cutPaper(): void
printer.startPrint(): void
printer.printTest(): void

NexgoScanner

const scanner = new NexgoScanner();

scanner.initScanner(): SdkResult
scanner.startScan(config?): void
scanner.stopScan(): void
scanner.getLastScanResult(): ScanResult | null
scanner.onScan(callback: (result: ScanResult) => void): void
scanner.offScan(): void

NexgoPinpad

const pinpad = new NexgoPinpad();

pinpad.initPinpad(): SdkResult
pinpad.startPinEntry(config?): void
pinpad.cancelPinEntry(): void
pinpad.getEncryptedPin(): PinResult | null
pinpad.onPinEntry(callback: (result: PinResult) => void): void
pinpad.offPinEntry(): void

NexgoBeeper

const beeper = new NexgoBeeper();

beeper.initBeeper(): SdkResult
beeper.beep(duration?): void
beeper.beepTone(tone, duration?): void

// Convenience methods
beeper.success(): void
beeper.error(): void
beeper.warning(): void
beeper.notification(): void
beeper.stopBeep(): void

React Hooks

useNexgo()

const {
  isReady,
  availability,
  printer,
  scanner,
  pinpad,
  beeper
} = useNexgo();

usePrinter()

const { printer, isReady, error } = usePrinter();

useScanner()

const {
  scanner,
  isReady,
  error,
  lastScan,
  startScan,
  stopScan
} = useScanner();

usePinpad()

const {
  pinpad,
  isReady,
  error,
  lastPin,
  startPinEntry,
  cancelPinEntry
} = usePinpad();

useBeeper()

const {
  beeper,
  isReady,
  error,
  beep,
  beepTone,
  success,
  error: errorBeep,
  warning,
  notification,
  stopBeep
} = useBeeper();

Enums

import {
  SdkResult,
  AlignEnum,
  BarcodeFormatEnum,
  GrayLevelEnum,
  ScanDecodeType,
  BeeperTone,
  BeeperDuration,
  PinEntryMode
} from 'nexgo-sdk';

TypeScript

This package includes full TypeScript definitions. All types are exported:

import type {
  FontEntity,
  LineOptionEntity,
  ScanResult,
  ScannerConfig,
  PinResult,
  PinpadConfig
} from 'nexgo-sdk';

Requirements

  • This SDK requires the Nexgo native APIs to be available in the runtime environment (typically an Android WebView with Nexgo device support)
  • React hooks require React 16.8.0 or higher

License

MIT