EventSource
Defined in: node_modules/.pnpm/@cloudflare+workers-types@4.20251118.0/node_modules/@cloudflare/workers-types/index.ts:3562
The EventSource interface is web content’s interface to server-sent events.
Extends
Section titled “Extends”Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new EventSource(
url,init?):EventSource
Defined in: node_modules/.pnpm/@cloudflare+workers-types@4.20251118.0/node_modules/@cloudflare/workers-types/index.ts:3563
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”EventSource
Overrides
Section titled “Overrides”Properties
Section titled “Properties”CLOSED
Section titled “CLOSED”
readonlystaticCLOSED:number
Defined in: node_modules/.pnpm/@cloudflare+workers-types@4.20251118.0/node_modules/@cloudflare/workers-types/index.ts:3602
CONNECTING
Section titled “CONNECTING”
readonlystaticCONNECTING:number
Defined in: node_modules/.pnpm/@cloudflare+workers-types@4.20251118.0/node_modules/@cloudflare/workers-types/index.ts:3600
readonlystaticOPEN:number
Defined in: node_modules/.pnpm/@cloudflare+workers-types@4.20251118.0/node_modules/@cloudflare/workers-types/index.ts:3601
Accessors
Section titled “Accessors”onerror
Section titled “onerror”Get Signature
Section titled “Get Signature”get onerror():
any
Defined in: node_modules/.pnpm/@cloudflare+workers-types@4.20251118.0/node_modules/@cloudflare/workers-types/index.ts:3597
Returns
Section titled “Returns”any
Set Signature
Section titled “Set Signature”set onerror(
value):void
Defined in: node_modules/.pnpm/@cloudflare+workers-types@4.20251118.0/node_modules/@cloudflare/workers-types/index.ts:3599
Parameters
Section titled “Parameters”any
Returns
Section titled “Returns”void
onmessage
Section titled “onmessage”Get Signature
Section titled “Get Signature”get onmessage():
any
Defined in: node_modules/.pnpm/@cloudflare+workers-types@4.20251118.0/node_modules/@cloudflare/workers-types/index.ts:3593
Returns
Section titled “Returns”any
Set Signature
Section titled “Set Signature”set onmessage(
value):void
Defined in: node_modules/.pnpm/@cloudflare+workers-types@4.20251118.0/node_modules/@cloudflare/workers-types/index.ts:3595
Parameters
Section titled “Parameters”any
Returns
Section titled “Returns”void
onopen
Section titled “onopen”Get Signature
Section titled “Get Signature”get onopen():
any
Defined in: node_modules/.pnpm/@cloudflare+workers-types@4.20251118.0/node_modules/@cloudflare/workers-types/index.ts:3589
Returns
Section titled “Returns”any
Set Signature
Section titled “Set Signature”set onopen(
value):void
Defined in: node_modules/.pnpm/@cloudflare+workers-types@4.20251118.0/node_modules/@cloudflare/workers-types/index.ts:3591
Parameters
Section titled “Parameters”any
Returns
Section titled “Returns”void
readyState
Section titled “readyState”Get Signature
Section titled “Get Signature”get readyState():
number
Defined in: node_modules/.pnpm/@cloudflare+workers-types@4.20251118.0/node_modules/@cloudflare/workers-types/index.ts:3587
The readyState read-only property of the connection.
Returns
Section titled “Returns”number
Get Signature
Section titled “Get Signature”get url():
string
Defined in: node_modules/.pnpm/@cloudflare+workers-types@4.20251118.0/node_modules/@cloudflare/workers-types/index.ts:3575
The url read-only property of the URL of the source.
Returns
Section titled “Returns”string
withCredentials
Section titled “withCredentials”Get Signature
Section titled “Get Signature”get withCredentials():
boolean
Defined in: node_modules/.pnpm/@cloudflare+workers-types@4.20251118.0/node_modules/@cloudflare/workers-types/index.ts:3581
The withCredentials read-only property of the the EventSource object was instantiated with CORS credentials set.
Returns
Section titled “Returns”boolean
Methods
Section titled “Methods”addEventListener()
Section titled “addEventListener()”addEventListener<
Type>(type,handler,options?):void
Defined in: node_modules/.pnpm/@cloudflare+workers-types@4.20251118.0/node_modules/@cloudflare/workers-types/index.ts:878
The addEventListener() method of the EventTarget interface sets up a function that will be called whenever the specified event is delivered to the target.
Type Parameters
Section titled “Type Parameters”Type extends string
Parameters
Section titled “Parameters”Type
handler
Section titled “handler”EventListenerOrEventListenerObject<Event>
options?
Section titled “options?”boolean | EventTargetAddEventListenerOptions
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”close()
Section titled “close()”close():
void
Defined in: node_modules/.pnpm/@cloudflare+workers-types@4.20251118.0/node_modules/@cloudflare/workers-types/index.ts:3569
The close() method of the EventSource interface closes the connection, if one is made, and sets the js-nolint close() None.
Returns
Section titled “Returns”void
dispatchEvent()
Section titled “dispatchEvent()”dispatchEvent(
event):boolean
Defined in: node_modules/.pnpm/@cloudflare+workers-types@4.20251118.0/node_modules/@cloudflare/workers-types/index.ts:898
The dispatchEvent() method of the EventTarget sends an Event to the object, (synchronously) invoking the affected event listeners in the appropriate order.
Parameters
Section titled “Parameters”Returns
Section titled “Returns”boolean
Inherited from
Section titled “Inherited from”removeEventListener()
Section titled “removeEventListener()”removeEventListener<
Type>(type,handler,options?):void
Defined in: node_modules/.pnpm/@cloudflare+workers-types@4.20251118.0/node_modules/@cloudflare/workers-types/index.ts:888
The removeEventListener() method of the EventTarget interface removes an event listener previously registered with EventTarget.addEventListener() from the target.
Type Parameters
Section titled “Type Parameters”Type extends string
Parameters
Section titled “Parameters”Type
handler
Section titled “handler”EventListenerOrEventListenerObject<Event>
options?
Section titled “options?”boolean | EventTargetEventListenerOptions
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”EventTarget.removeEventListener
from()
Section titled “from()”
staticfrom(stream):EventSource
Defined in: node_modules/.pnpm/@cloudflare+workers-types@4.20251118.0/node_modules/@cloudflare/workers-types/index.ts:3603
Parameters
Section titled “Parameters”stream
Section titled “stream”Returns
Section titled “Returns”EventSource