@webref/events (original) (raw)

1.18.6 • Public • Published 2 days ago

Events of the Web platform and associated Web IDL interfaces

This package contains a consolidated list of events defined across specs, scraped from the latest versions of web platform specifications in webref, along with the name of the Web IDL interfaces that these events use and target. Fixes are applied to ensure that guarantees hold.

API

The async listAll() method resolves with a list of events. Example:

const events = require('@webref/events');

events.listAll().then(all => { for (const event of all) { // do something with the json object that describes the event } });

Each event is described by an object with the following properties:

The following example illustrates access to main properties:

const events = require('@webref/events');

events.listAll().then(all => { for (const event of all) { console.log(); console.log(Event type=${event.type} interface=${event.interface} targets=${event.targets .map(t => t.target + (t.bubbles === undefined ? '' : (bubbles: ${t.bubbles}))) .join(', ')}); } });

Actual interfaces on which an event will bubble may be interfaces that inherit from the interfaces listed in bubblingPath. For instance, for a bubbling event that fires on HTMLSelectElement, the bubbling path will be ["Node", "Document", "Window"], even though the event will only bubble on HTMLElement and not on all types of Node in practice.

Guarantees

The following guarantees are provided by this package: