@Generated(value="org.realityforge.webtack")
@JsType(isNative=true,
namespace="<global>",
name="EventSource")
public class EventSource
extends EventTarget
| Modifier and Type | Field and Description |
|---|---|
static int |
CLOSED |
static int |
CONNECTING |
@JsNullable EventHandler |
onerror
The onerror property of the EventSource interface is an EventHandler called when an error occurs and the error event is dispatched on an EventSource object.
|
@JsNullable MessageEventHandler |
onmessage
The onmessage property of the EventSource interface is an EventHandler called when a message event is received, that is when a message is coming from the source.
|
@JsNullable EventHandler |
onopen
The onopen property of the EventSource interface is an EventHandler called when an open event is received, that is when the connection was just opened.
|
static int |
OPEN |
| Constructor and Description |
|---|
EventSource(java.lang.String url)
The EventSource() constructor returns a newly-created EventSource, which represents a remote resource.
|
EventSource(java.lang.String url,
EventSourceInit eventSourceInitDict)
The EventSource() constructor returns a newly-created EventSource, which represents a remote resource.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addErrorListener(EventListener callback) |
void |
addErrorListener(EventListener callback,
AddEventListenerOptions options) |
void |
addErrorListener(EventListener callback,
boolean useCapture) |
void |
addMessageListener(MessageEventListener callback) |
void |
addMessageListener(MessageEventListener callback,
AddEventListenerOptions options) |
void |
addMessageListener(MessageEventListener callback,
boolean useCapture) |
void |
addOpenListener(EventListener callback) |
void |
addOpenListener(EventListener callback,
AddEventListenerOptions options) |
void |
addOpenListener(EventListener callback,
boolean useCapture) |
void |
close()
The close() method of the EventSource interface closes the connection, if one is made, and sets the EventSource.readyState attribute to 2 (closed).
|
int |
readyState()
The readyState read-only property of the EventSource interface returns a number representing the state of the connection.
|
void |
removeErrorListener(EventListener callback) |
void |
removeErrorListener(EventListener callback,
boolean useCapture) |
void |
removeErrorListener(EventListener callback,
EventListenerOptions options) |
void |
removeMessageListener(MessageEventListener callback) |
void |
removeMessageListener(MessageEventListener callback,
boolean useCapture) |
void |
removeMessageListener(MessageEventListener callback,
EventListenerOptions options) |
void |
removeOpenListener(EventListener callback) |
void |
removeOpenListener(EventListener callback,
boolean useCapture) |
void |
removeOpenListener(EventListener callback,
EventListenerOptions options) |
java.lang.String |
url()
The url read-only property of the EventSource interface returns a DOMString representing the URL of the source.
|
boolean |
withCredentials()
The withCredentials read-only property of the EventSource interface returns a Boolean indicating whether the EventSource object was instantiated with CORS credentials set.
|
addEventListener, addEventListener, addEventListener, dispatchEvent, removeEventListener, removeEventListener, removeEventListenerassign, create, create, defineProperties, defineProperty, defineProperty, entries, freeze, fromEntries, getOwnPropertyDescriptor, getOwnPropertyDescriptor, getOwnPropertyDescriptors, getOwnPropertyNames, getOwnPropertySymbols, getPrototypeOf, hasOwnProperty, hasOwnProperty, is, isExtensible, isFrozen, isPrototypeOf, isSealed, keys, preventExtensions, propertyIsEnumerable, seal, setPrototypeOf, toString_, valueOf_, values@JsOverlay public static final int CLOSED
@JsOverlay public static final int CONNECTING
@JsOverlay public static final int OPEN
public @JsNullable EventHandler onerror
public @JsNullable MessageEventHandler onmessage
public @JsNullable EventHandler onopen
public EventSource(@Nonnull
java.lang.String url,
@Nonnull
EventSourceInit eventSourceInitDict)
public EventSource(@Nonnull
java.lang.String url)
@JsProperty(name="readyState") @EventSourceReadyState public int readyState()
@JsProperty(name="url") @Nonnull public java.lang.String url()
@JsProperty(name="withCredentials") public boolean withCredentials()
public void close()
@JsOverlay
public final void addMessageListener(@Nonnull
MessageEventListener callback,
@Nonnull
AddEventListenerOptions options)
@JsOverlay
public final void addMessageListener(@Nonnull
MessageEventListener callback,
boolean useCapture)
@JsOverlay
public final void addMessageListener(@Nonnull
MessageEventListener callback)
@JsOverlay
public final void removeMessageListener(@Nonnull
MessageEventListener callback,
@Nonnull
EventListenerOptions options)
@JsOverlay
public final void removeMessageListener(@Nonnull
MessageEventListener callback,
boolean useCapture)
@JsOverlay
public final void removeMessageListener(@Nonnull
MessageEventListener callback)
@JsOverlay
public final void addErrorListener(@Nonnull
EventListener callback,
@Nonnull
AddEventListenerOptions options)
@JsOverlay
public final void addErrorListener(@Nonnull
EventListener callback,
boolean useCapture)
@JsOverlay
public final void addErrorListener(@Nonnull
EventListener callback)
@JsOverlay
public final void removeErrorListener(@Nonnull
EventListener callback,
@Nonnull
EventListenerOptions options)
@JsOverlay
public final void removeErrorListener(@Nonnull
EventListener callback,
boolean useCapture)
@JsOverlay
public final void removeErrorListener(@Nonnull
EventListener callback)
@JsOverlay
public final void addOpenListener(@Nonnull
EventListener callback,
@Nonnull
AddEventListenerOptions options)
@JsOverlay
public final void addOpenListener(@Nonnull
EventListener callback,
boolean useCapture)
@JsOverlay
public final void addOpenListener(@Nonnull
EventListener callback)
@JsOverlay
public final void removeOpenListener(@Nonnull
EventListener callback,
@Nonnull
EventListenerOptions options)
@JsOverlay
public final void removeOpenListener(@Nonnull
EventListener callback,
boolean useCapture)
@JsOverlay
public final void removeOpenListener(@Nonnull
EventListener callback)