Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

custom-event

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

custom-event

Cross-browser `CustomEvent` constructor

  • 1.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2.9M
increased by2.78%
Maintainers
1
Weekly downloads
 
Created

What is custom-event?

The custom-event npm package allows developers to create and manage custom events in JavaScript environments. This package is particularly useful for handling custom event-driven interactions in applications, making it easier to manage asynchronous code and event-based logic.

What are custom-event's main functionalities?

Creating custom events

This feature allows developers to create a new custom event with a specified type and optional details. The event can then be dispatched to trigger event listeners that are set up to respond to it.

const CustomEvent = require('custom-event');
const event = new CustomEvent('my-event', { detail: { message: 'Hello world!' } });
document.dispatchEvent(event);

Listening to custom events

This code sets up an event listener for 'my-event'. When this event is dispatched, the listener triggers and logs the message contained in the event's details.

document.addEventListener('my-event', function(e) { console.log(e.detail.message); });

Other packages similar to custom-event

Keywords

FAQs

Package last updated on 07 Jan 2015

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

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc