File: dom-monkeypatch.d.ts

package info (click to toggle)
node-eventsource 2.0.2%2B~1.1.10-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,196 kB
  • sloc: javascript: 8,258; makefile: 4
file content (92 lines) | stat: -rwxr-xr-x 3,419 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
/**
 * The Event interface represents any event which takes place in the DOM; some are user-generated (such as mouse or keyboard events), while others are generated by APIs (such as
 * events that indicate an animation has finished running, a video has been paused, and so forth). While events are usually triggered by such "external" sources, they can also be
 * triggered programmatically, such as by calling the HTMLElement.click() method of an element, or by defining the event, then sending it to a specified target using
 * EventTarget.dispatchEvent(). There are many types of events, some of which use other interfaces based on the main Event interface. Event itself contains the properties and
 * methods which are common to all events.
 */
interface Event {
  /**
   * Returns true or false depending on how event was initialized. True if event goes through its target's ancestors in reverse tree order, and false otherwise.
   */
  readonly bubbles: boolean;
  cancelBubble: boolean;
  readonly cancelable: boolean;
  /**
   * Returns true or false depending on how event was initialized. True if event invokes listeners past a ShadowRoot node that is the root of its target, and false otherwise.
   */
  readonly composed: boolean;
  readonly defaultPrevented: boolean;
  readonly eventPhase: number;
  /**
   * Returns true if event was dispatched by the user agent, and
   * false otherwise.
   */
  readonly isTrusted: boolean;
  returnValue: boolean;
  /**
   * Returns the event's timestamp as the number of milliseconds measured relative to
   * the time origin.
   */
  readonly timeStamp: number;
  /**
   * Unauthorized and redirect error status codes (for example 401, 403, 301, 307)
   */
  readonly status?: number | undefined;
  /**
   * Returns the type of event, e.g.
   * "click", "hashchange", or
   * "submit".
   */
  readonly type: string;
  readonly AT_TARGET: number;
  readonly BUBBLING_PHASE: number;
  readonly CAPTURING_PHASE: number;
  readonly NONE: number;
  composedPath(): any[];
  initEvent(type: string, bubbles?: boolean, cancelable?: boolean): void;
  preventDefault(): void;
  /**
   * Invoking this method prevents event from reaching
   * any registered event listeners after the current one finishes running and, when dispatched in a tree, also prevents event from reaching any
   * other objects.
   */
  stopImmediatePropagation(): void;
  /**
   * When dispatched in a tree, invoking this method prevents event from reaching any objects other than the current object.
   */
  stopPropagation(): void;
}

interface EventInit {
  bubbles?: boolean | undefined;
  cancelable?: boolean | undefined;
  composed?: boolean | undefined;
}

interface MessageEventInit<T = any> extends EventInit {
  data?: T | undefined;
  lastEventId?: string | undefined;
  origin?: string | undefined;
}

/** The MessageEvent interface represents a message received by a target object. */
interface MessageEvent<T = any> extends Event {
  /**
   * Returns the data of the message.
   */
  readonly data: T;
  /**
   * Returns the last event ID string, for server-sent events.
   */
  readonly lastEventId: string;
  /**
   * Returns the origin of the message, for server-sent events and
   * cross-document messaging.
   */
  readonly origin: string;
}
declare var MessageEvent: {
  prototype: MessageEvent;
  new<T>(type: string, eventInitDict?: MessageEventInit<T>): MessageEvent<T>;
};