EventSource

@native @JSGlobal @JSType
class EventSource extends EventTarget

EventSource enables servers to push data to Web pages over HTTP or using dedicated server-push protocols. Event streams requests can be redirected using HTTP 301 and 307 redirects as with normal HTTP requests. Clients will reconnect if the connection is closed; a client can be told to stop reconnecting using the HTTP 204 No Content response code. W3C 2012

Companion:
object
class Object
trait Any
class Object
trait Matchable
class Any

Value members

Constructors

def this(url: String, configuration: EventSourceInit)

Concrete methods

def close(): Unit

The close() method must abort any instances of the fetch algorithm started for this EventSource object, and must set the readyState attribute to CLOSED. W3C 2012

The close() method must abort any instances of the fetch algorithm started for this EventSource object, and must set the readyState attribute to CLOSED. W3C 2012

def readyState: Int

The readyState attribute represents the state of the connection. W3C 2012

The readyState attribute represents the state of the connection. W3C 2012

def url: String

The url attribute must return the absolute URL that resulted from resolving the value that was passed to the constructor. W3C 2012

The url attribute must return the absolute URL that resulted from resolving the value that was passed to the constructor. W3C 2012

def withCredentials: Boolean

The withCredentials attribute must return the value to which it was last initialized. When the object is created without withCredentials presents in the settings, it must be initialized to false. If it has the value true, then set CORS mode to Use Credentials and initialize the new EventSource object's withCredentials attribute. W3C 2012

The withCredentials attribute must return the value to which it was last initialized. When the object is created without withCredentials presents in the settings, it must be initialized to false. If it has the value true, then set CORS mode to Use Credentials and initialize the new EventSource object's withCredentials attribute. W3C 2012

Inherited methods

def addEventListener[T <: Event](`type`: String, listener: Function1[T, _], options: EventListenerOptions): Unit

The EventTarget.addEventListener() method registers the specified listener on the EventTarget it's called on. The event target may be an Element in a document, the Document itself, a Window, or any other object that supports events (such as XMLHttpRequest).

The EventTarget.addEventListener() method registers the specified listener on the EventTarget it's called on. The event target may be an Element in a document, the Document itself, a Window, or any other object that supports events (such as XMLHttpRequest).

This implementation accepts a settings object of type EventListenerOptions.

Inherited from:
EventTarget
def addEventListener[T <: Event](`type`: String, listener: Function1[T, _], useCapture: Boolean): Unit

The EventTarget.addEventListener() method registers the specified listener on the EventTarget it's called on. The event target may be an Element in a document, the Document itself, a Window, or any other object that supports events (such as XMLHttpRequest).

The EventTarget.addEventListener() method registers the specified listener on the EventTarget it's called on. The event target may be an Element in a document, the Document itself, a Window, or any other object that supports events (such as XMLHttpRequest).

Inherited from:
EventTarget
def dispatchEvent(evt: Event): Boolean

Dispatches an Event at the specified EventTarget, invoking the affected EventListeners in the appropriate order. The normal event processing rules (including the capturing and optional bubbling phase) apply to events dispatched manually with dispatchEvent().

Dispatches an Event at the specified EventTarget, invoking the affected EventListeners in the appropriate order. The normal event processing rules (including the capturing and optional bubbling phase) apply to events dispatched manually with dispatchEvent().

Inherited from:
EventTarget
def hasOwnProperty(v: String): Boolean
Inherited from:
Object
def isPrototypeOf(v: Object): Boolean
Inherited from:
Object
def propertyIsEnumerable(v: String): Boolean
Inherited from:
Object
def removeEventListener[T <: Event](`type`: String, listener: Function1[T, _], options: EventListenerOptions): Unit

Removes the event listener previously registered with EventTarget.addEventListener.

Removes the event listener previously registered with EventTarget.addEventListener.

This implementation accepts a settings object of type EventListenerOptions.

Inherited from:
EventTarget
def removeEventListener[T <: Event](`type`: String, listener: Function1[T, _], useCapture: Boolean): Unit

Removes the event listener previously registered with EventTarget.addEventListener.

Removes the event listener previously registered with EventTarget.addEventListener.

Inherited from:
EventTarget
def toLocaleString(): String
Inherited from:
Object
def valueOf(): Any
Inherited from:
Object

Concrete fields

var onerror: Function1[ErrorEvent, _]
var onmessage: Function1[MessageEvent, _]
var onopen: Function1[Event, _]