Sha256: 93507c745e8f29090efb99399c3f77bec07db17acd75634249dc92f961573387

Contents?: true

Size: 1.63 KB

Versions: 29

Compression:

Stored size: 1.63 KB

Contents

import { MessageEvent, ErrorEvent } from './websocket'
import Dispatcher from './dispatcher'

import {
  EventTarget,
  Event,
  EventListenerOptions,
  AddEventListenerOptions,
  EventListenerOrEventListenerObject
} from './patch'

interface EventSourceEventMap {
  error: ErrorEvent
  message: MessageEvent
  open: Event
}

interface EventSource extends EventTarget {
  close(): void
  readonly CLOSED: 2
  readonly CONNECTING: 0
  readonly OPEN: 1
  onerror: (this: EventSource, ev: ErrorEvent) => any
  onmessage: (this: EventSource, ev: MessageEvent) => any
  onopen: (this: EventSource, ev: Event) => any
  readonly readyState: 0 | 1 | 2
  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: EventListenerOrEventListenerObject,
    options?: boolean | AddEventListenerOptions
  ): void
  removeEventListener<K extends keyof EventSourceEventMap>(
    type: K,
    listener: (this: EventSource, ev: EventSourceEventMap[K]) => any,
    options?: boolean | EventListenerOptions
  ): void
  removeEventListener(
    type: string,
    listener: EventListenerOrEventListenerObject,
    options?: boolean | EventListenerOptions
  ): void
}

export declare const EventSource: {
  prototype: EventSource
  new (url: string | URL, init?: EventSourceInit): EventSource
  readonly CLOSED: 2
  readonly CONNECTING: 0
  readonly OPEN: 1
}

interface EventSourceInit {
  withCredentials?: boolean,
  dispatcher?: Dispatcher
}

Version data entries

29 entries across 29 versions & 3 rubygems

Version Path
clapton-0.0.26 lib/clapton/javascripts/node_modules/undici-types/eventsource.d.ts
clapton-0.0.25 lib/clapton/javascripts/node_modules/undici-types/eventsource.d.ts
clapton-0.0.24 lib/clapton/javascripts/node_modules/undici-types/eventsource.d.ts
clapton-0.0.23 lib/clapton/javascripts/node_modules/undici-types/eventsource.d.ts
clapton-0.0.22 lib/clapton/javascripts/node_modules/undici-types/eventsource.d.ts
clapton-0.0.21 lib/clapton/javascripts/node_modules/undici-types/eventsource.d.ts
clapton-0.0.20 lib/clapton/javascripts/node_modules/undici-types/eventsource.d.ts
clapton-0.0.19 lib/clapton/javascripts/node_modules/undici-types/eventsource.d.ts
clapton-0.0.18 lib/clapton/javascripts/node_modules/undici-types/eventsource.d.ts
clapton-0.0.17 lib/clapton/javascripts/node_modules/undici-types/eventsource.d.ts
clapton-0.0.16 lib/clapton/javascripts/node_modules/undici-types/eventsource.d.ts
clapton-0.0.15 lib/clapton/javascripts/node_modules/undici-types/eventsource.d.ts
clapton-0.0.14 lib/clapton/javascripts/node_modules/undici-types/eventsource.d.ts
clapton-0.0.13 lib/clapton/javascripts/node_modules/undici-types/eventsource.d.ts
clapton-0.0.12 lib/clapton/javascripts/node_modules/undici-types/eventsource.d.ts
clapton-0.0.11 lib/clapton/javascripts/node_modules/undici-types/eventsource.d.ts
clapton-0.0.10 lib/clapton/javascripts/node_modules/undici-types/eventsource.d.ts
clapton-0.0.9 lib/clapton/javascripts/node_modules/undici-types/eventsource.d.ts
clapton-0.0.8 lib/clapton/javascripts/node_modules/undici-types/eventsource.d.ts
clapton-0.0.7 lib/clapton/javascripts/node_modules/undici-types/eventsource.d.ts