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

js-global-error-handler

v1.0.2

Published

A professional-grade, lightweight JavaScript library for capturing and reporting client-side errors.

Downloads

33

Readme

JS Global Error Handler SDK

A professional-grade, lightweight JavaScript library for capturing and reporting client-side errors.

https://www.npmjs.com/package/js-global-error-handler

Features

  • Multi-Source Capture: Catch errors from window.onerror, Promise rejections, Fetch/XHR failures, and manual console.error calls.
  • Normalization: Automatically formats various error types into a consistent JSON payload.
  • Fingerprinting: Built-in deduplication to prevent flooding your servers with the same error.
  • Aggressive Tracking: Monkey-patches core APIs in development/QA environments for deep visibility.
  • Zero Dependencies: Lightweight and vanilla JavaScript.

Getting Started

Installation

npm install js-global-error-handler

Usage

Option 1: NPM (React, Vue, Angular, etc.)

import { init } from 'js-global-error-handler';

// Initialize at the very top of your app
init({
  endpoint: 'https://api.yourdomain.com/errors',
  method: 'POST', 
  env: 'production',
  reportingEnabled: true
});

Option 2: CDN / Script Tag (Legacy, Vanilla JS)

<!-- Load the library -->
<script src="https://cdn.jsdelivr.net/npm/js-global-error-handler/dist/tracker.umd.js"></script>

<script>
  ErrorTracker.init({
    endpoint: 'https://api.yourdomain.com/errors',
    method: 'POST',
    env: 'production'
  });
</script>

Configuration Options

Pass these options to the init() function:

| Option | Type | Default | Description | |--------|------|---------|-------------| | endpoint | string | '/api/error/add' | API URL where errors will be sent. | | method | string | 'POST' | HTTP method (POST, PUT, GET). | | env | string | 'development' | Environment mode. production enables sending reports. | | reportingEnabled | boolean | false | Master switch to enable/disable network reporting. | | maxSameError | number | 5 | Prevents flooding by limiting duplicate error reports. | | aggressiveTracking | boolean | true | Monkey-patches console.error, fetch, and XMLHttpRequest for deeper visibility. |

Development commands

  • npm run dev: Start development server with demo dashboard.
  • npm run build: Build the library and demo files for production.

Directory Structure

  • src/js/tracker.js: Main entry point.
  • src/js/utils.js: Error normalization and logic.
  • src/js/transports.js: Network transmission.
  • src/js/config.js: Centralized settings.

License

MIT