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

dom-event-object

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dom-event-object

Allow any class to have EventTarget methods (addEventListener, removeEventLister and dispatchEvent)

  • 1.0.5
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

Add EventTarget methods to any class by extending them with EventObject

export declare type EventListenerCallback = (event: Event) => any;
export interface EventListenerOptions {
    once?: boolean;
    passive?: boolean;
    capture?: boolean;
}

export declare class EventObject implements EventTarget {

	protected _eventTarget: EventTarget;  // the original element which will receive events binding

    constructor(target?: EventTarget);  // if required a specific target can be selected

    // because Events can bubbles, you can append or remove children like in a Node tree
    readonly childEventObjects: EventObject[];
    readonly parentEventObject: EventObject;

	appendChild(target: EventObject): EventObject;
	removeChild(target: EventObject): EventObject;

    // standard EventTarget methods
    addEventListener(type: string, callback: EventListenerCallback, options?: (EventListenerOptions | boolean)): void;
    dispatchEvent(event: Event): boolean;
    removeEventListener(type: string, callback: EventListenerCallback, options?: (EventListenerOptions | boolean)): void;

FAQs

Package last updated on 10 May 2017

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