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

com.hydroper.typedeventtarget

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
Package was removed
Sorry, it seems this package was removed from the registry

com.hydroper.typedeventtarget

Provide types of dispatched events in event targets.

latest
Source
npmnpm
Version
1.0.1
Version published
Maintainers
1
Created
Source

Typed event target

Easily define event types for an EventTarget, crediting to this article.

Getting started

The following program defines play and stop events.

import { TypedEventTarget } from "com.hydroper.typedeventtarget";

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 15 Mar 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