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

@whatwg-node/events

Package Overview
Dependencies
Maintainers
1
Versions
50
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@whatwg-node/events

Cross Platform Smart Event API Ponyfill

  • 0.0.3-alpha-20230423082325-8a114d1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
890K
decreased by-80.5%
Maintainers
1
Weekly downloads
 
Created
Source

@whatwg-node/events

A ponyfill package for JavaScript DOM Events Standard. If your JavaScript environment doesn't implement this standard natively, this package automatically ponyfills the missing parts, and export them as a module.

Installation

yarn add @whatwg-node/events

Usage

import { Event, EventTarget } from '@whatwg-node/events'

const target = new EventTarget()
target.addEventListener('foo', (event: Event) => {
  console.log(event.type) // foo
})

target.dispatchEvent(new Event('foo'))

If your environment already implements these natively, this package will export the native ones automatically.

Custom Events

import { CustomEvent, EventTarget } from '@whatwg-node/events'

const target = new EventTarget()
target.addEventListener('foo', (event: CustomEvent) => {
  console.assert(event.detail.foo, 'bar')
})

// `detail` can take any value
target.dispatchEvent(new CustomEvent('foo', { detail: { foo: 'bar' } }))

API

The following classes are exported by this package:

FAQs

Package last updated on 23 Apr 2023

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