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.0
  • 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 true element which will receive events binding

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

    // 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;

    // because Events can bubbles, you can had or remove children
    appendChild(target: (EventObject | any)): void;
    removeChild(target: (EventObject | any)): 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