Documentation / @eventkit/http / eventSourceObservable
Function: eventSourceObservable()
Call Signature
ts
function eventSourceObservable<T>(source, opts): AsyncObservable<EventSourceEvent<T>>Creates an AsyncObservable from an EventSource instance.
Type Parameters
| Type Parameter | Description |
|---|---|
T | The type of data contained in message events |
Parameters
| Parameter | Type | Description |
|---|---|---|
source | EventSource | The EventSource instance to convert to an AsyncObservable |
opts | { dematerialize: true; } | Configuration options for the observable |
opts.dematerialize | true | When true, yields full event objects including metadata. When false or omitted, yields only the message data. |
Returns
AsyncObservable<EventSourceEvent<T>>
An AsyncObservable that yields either raw message data or full event objects
Call Signature
ts
function eventSourceObservable<T>(source, opts?): AsyncObservable<T>Creates an AsyncObservable from an EventSource instance.
Type Parameters
| Type Parameter | Description |
|---|---|
T | The type of data contained in message events |
Parameters
| Parameter | Type | Description |
|---|---|---|
source | EventSource | The EventSource instance to convert to an AsyncObservable |
opts? | { dematerialize: false; } | Configuration options for the observable |
opts.dematerialize? | false | When true, yields full event objects including metadata. When false or omitted, yields only the message data. |
Returns
AsyncObservable<T>
An AsyncObservable that yields either raw message data or full event objects