🚀 Socket Launch Week Day 5:Introducing Repository Access Permissions and Custom Roles.Learn more
Sign In

@hydroperx/event

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@hydroperx/event

Provide types of dispatched events in event targets.

Source
npmnpm
Version
1.0.2
Version published
Weekly downloads
11
57.14%
Maintainers
1
Weekly downloads
 
Created
Source

Event

Easily define event types for an EventTarget. Credits to this article.

Getting started

The following program defines play and stop events.

import { TypedEventTarget } from "@hydroperx/event";

class MediaPlayer extends (EventTarget as TypedEventTarget<{
    play: CustomEvent<MediaPlayerEvent>;
    stop: CustomEvent<MediaPlayerEvent>;
}>) {}

Note that event types must implement the Event interface, thus in the previous program CustomEvent is used; if there was no data, it could have just been Event itself.

Keywords

event

FAQs

Package last updated on 26 Apr 2025

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