New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

js-error-notifier

Package Overview
Dependencies
Maintainers
0
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

js-error-notifier

A TypeScript library for displaying error pop-ups when console errors or unhandled exceptions occur.

latest
Source
npmnpm
Version
1.0.5
Version published
Maintainers
0
Created
Source

Error Notifier

A TypeScript library for displaying error pop-ups when console errors or unhandled exceptions occur. This is useful for testing and debugging applications by ensuring that errors are visually noticeable.

Installation

To use this library, first clone the repository or download the source code. Then install TypeScript if you haven't already:

npm i js-error-notifier

Usage

import { errorNotifier } from 'js-error-notifier';

// Enable error notifications
errorNotifier.enable();

How It Works

The Index class overrides console.error and listens for window-level errors and unhandled promise rejections.
When an error occurs, a pop-up notification appears in the bottom-right corner of the screen, displaying the error message.
The notification disappears after 5 seconds.

Example

Here's a simple example of how to use the library in your project:

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Error Notifier Example</title>
</head>
<body>
  <script src="dist/Index.js"></script>
  <script>
    // Import and enable the error notifier
    errorNotifier.enable();

    // Example errors
    console.error("This is a test error!");
  </script>
</body>
</html>

Customization

The current version of the library has a fixed style for error pop-ups.
Future updates may include customizable styles, positions, and more.

License

This library is open-source and distributed under the MIT License.

Keywords

typescript

FAQs

Package last updated on 04 Nov 2024

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