class EventSource extends Object with EventTarget
The EventSource interface is used to receive server-sent events. It connects to a server over HTTP and receives events in text/event-stream format without closing the connection.
- Annotations
- @RawJSType() @native() @JSName( "EventSource" )
- See also
https://developer.mozilla.org/en-US/docs/Web/API/EventSource
- Alphabetic
- By Inheritance
- EventSource
- EventTarget
- Object
- Any
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Instance Constructors
-
new
EventSource(url: String)
- url
A DOMString representing the URL of the source.
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
addEventListener(type: String, listener: Function, useCapture: Boolean): Unit
Register an event handler of a specific event type on the EventTarget.
Register an event handler of a specific event type on the EventTarget.
- listener
The object that receives a notification (an object that implements the Event interface) when an event of the specified type occurs. This must be an object implementing the EventListener interface, or simply a JavaScript function.
- useCapture
A Boolean that indicates that events of this type will be dispatched to the registered listener before being dispatched to any EventTarget beneath it in the DOM tree. Events that are bubbling upward through the tree will not trigger a listener designated to use capture. Event bubbling and capturing are two ways of propagating events that occur in an element that is nested within another element, when both elements have registered a handle for that event. The event propagation mode determines the order in which elements receive the event. See DOM Level 3 Events and JavaScript Event order for a detailed explanation. If not specified, useCapture defaults to false.
- Definition Classes
- EventTarget
-
def
addEventListener(type: String, listener: Function, options: |[EventTargetOptions, RawOptions]): Unit
Register an event handler of a specific event type on the EventTarget.
Register an event handler of a specific event type on the EventTarget.
- listener
The object that receives a notification (an object that implements the Event interface) when an event of the specified type occurs. This must be an object implementing the EventListener interface, or simply a JavaScript function.
- options
An options object that specifies characteristics about the event listener.
- Definition Classes
- EventTarget
-
def
addEventListener(type: String, listener: Function): Unit
Register an event handler of a specific event type on the EventTarget.
Register an event handler of a specific event type on the EventTarget.
- listener
The object that receives a notification (an object that implements the Event interface) when an event of the specified type occurs. This must be an object implementing the EventListener interface, or simply a JavaScript function.
- Definition Classes
- EventTarget
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
clone(): AnyRef
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
def
close(): Unit
Closes the connection, if any, and sets the readyState attribute to CLOSED.
Closes the connection, if any, and sets the readyState attribute to CLOSED. If the connection is already closed, the method does nothing.
-
def
dispatchEvent(event: Event): Boolean
Dispatch an event to this EventTarget.
Dispatch an event to this EventTarget.
- event
event is the Event object to be dispatched.
- returns
false if event is cancelable and at least one of the event handlers which handled this event called Event.preventDefault(). Otherwise it returns true.
- Definition Classes
- EventTarget
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
finalize(): Unit
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
-
def
hasOwnProperty(v: String): Boolean
- Definition Classes
- Object
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
def
isPrototypeOf(v: Object): Boolean
- Definition Classes
- Object
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
-
var
onerror: Function
Is an EventHandler being called when an error occurs and the error event is dispatched on this object.
-
var
onmessage: Function
Is an EventHandler being called when a message event is received, that is when a message is coming from the source.
-
var
onopen: Function
Is an EventHandler being called when an open event is received, that is when the connection was just opened.
-
def
propertyIsEnumerable(v: String): Boolean
- Definition Classes
- Object
-
def
readyState: Int
Read only: An unsigned short representing the state of the connection.
Read only: An unsigned short representing the state of the connection. Possible values are CONNECTING (0), OPEN (1), or CLOSED (2).
-
def
removeEventListener(type: String, listener: Function, useCapture: Boolean): Unit
Removes an event listener from the EventTarget.
Removes an event listener from the EventTarget.
- listener
The EventListener function to remove from the event target.
- useCapture
Specifies whether the EventListener to be removed is registered as a capturing listener or not. If this parameter is absent, a default value of false is assumed. If a listener is registered twice, one with capture and one without, remove each one separately. Removal of a capturing listener does not affect a non-capturing version of the same listener, and vice versa.
- Definition Classes
- EventTarget
-
def
removeEventListener(type: String, listener: Function, options: |[EventTargetOptions, RawOptions]): Unit
Removes an event listener from the EventTarget.
Removes an event listener from the EventTarget.
- listener
The EventListener function to remove from the event target.
- options
An options object that specifies characteristics about the event listener.
- Definition Classes
- EventTarget
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toLocaleString(): String
- Definition Classes
- Object
-
def
toString(): String
- Definition Classes
- AnyRef → Any
- val url: String
-
def
valueOf(): Any
- Definition Classes
- Object
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )