EventSource
interface EventSource extends EventTarget {
readonly CLOSED: number;
readonly CONNECTING: number;
onerror: ((this: EventSource, ev: Event) => any) | null;
onmessage: ((this: EventSource, ev: MessageEvent) => any) | null;
onopen: ((this: EventSource, ev: Event) => any) | null;
readonly OPEN: number;
readonly readyState: number;
readonly url: string;
readonly withCredentials: boolean;
addEventListener<K extends keyof EventSourceEventMap>(
type: K,
listener: (this: EventSource, ev: EventSourceEventMap[K]) => any,
options?: boolean | AddEventListenerOptions,
): void;addEventListener(
type: string,
listener: (this: EventSource, event: MessageEvent) => any,
options?: boolean | AddEventListenerOptions,
): void;addEventListener(
type: string,
listener: EventListenerOrEventListenerObject,
options?: boolean | AddEventListenerOptions,
): void;close(): void;
removeEventListener<K extends keyof EventSourceEventMap>(
type: K,
listener: (this: EventSource, ev: EventSourceEventMap[K]) => any,
options?: boolean | EventListenerOptions,
): void;removeEventListener(
type: string,
listener: (this: EventSource, event: MessageEvent) => any,
options?: boolean | EventListenerOptions,
): void;removeEventListener(
}type: string,
listener: EventListenerOrEventListenerObject,
options?: boolean | EventListenerOptions,
): void;var EventSource: {
prototype: EventSource;
readonly CLOSED: number;
readonly CONNECTING: number;
readonly OPEN: number;
new (url: string | URL, eventSourceInitDict?: EventSourceInit): EventSource;
};§Extends
§Properties
§
onerror: ((this: EventSource, ev: Event) => any) | null
[src]§
onmessage: ((this: EventSource, ev: MessageEvent) => any) | null
[src]§
onopen: ((this: EventSource, ev: Event) => any) | null
[src]§Methods
§
addEventListener<K extends keyof EventSourceEventMap>(
[src]type: K,
listener: (this: EventSource, ev: EventSourceEventMap[K]) => any,
options?: boolean | AddEventListenerOptions,
): void§
addEventListener(
[src]type: string,
listener: (this: EventSource, event: MessageEvent) => any,
options?: boolean | AddEventListenerOptions,
): void§
addEventListener(
[src]type: string,
listener: EventListenerOrEventListenerObject,
options?: boolean | AddEventListenerOptions,
): void§
close(): void
[src]Aborts any instances of the fetch algorithm started for this EventSource object, and sets the readyState attribute to CLOSED.
§
removeEventListener<K extends keyof EventSourceEventMap>(
[src]type: K,
listener: (this: EventSource, ev: EventSourceEventMap[K]) => any,
options?: boolean | EventListenerOptions,
): void§
removeEventListener(
[src]type: string,
listener: (this: EventSource, event: MessageEvent) => any,
options?: boolean | EventListenerOptions,
): void§
removeEventListener(
[src]type: string,
listener: EventListenerOrEventListenerObject,
options?: boolean | EventListenerOptions,
): void