BrowserStream
Browser DOM event streams.
This module provides typed constructors that turn window.addEventListener and document.addEventListener events into Effect Stream values. Both helpers accept the usual listener options and an optional stream buffer size.
Constructors
fromEventListenerDocument
Added in v4.0.0
Source
Signature
declare function fromEventListenerDocument<K extends keyof DocumentEventMap>(
type: K,
options?:
| boolean
| {
readonly bufferSize?: number;
readonly capture?: boolean;
readonly once?: boolean;
readonly passive?: boolean;
},
): Stream<DocumentEventMap[K], never, never>;fromEventListenerWindow
Added in v4.0.0
Source
Creates a Stream from window.addEventListener.
Details
By default, the underlying buffer is unbounded in size. You can customize the buffer size by passing an object as the second argument with the bufferSize field.
Signature
declare function fromEventListenerWindow<K extends keyof WindowEventMap>(
type: K,
options?:
| boolean
| {
readonly bufferSize?: number;
readonly capture?: boolean;
readonly once?: boolean;
readonly passive?: boolean;
},
): Stream<WindowEventMap[K], never, never>;
Creates a
Streamfromdocument.addEventListener.Details
By default, the underlying buffer is unbounded in size. You can customize the buffer size by passing an object as the second argument with the
bufferSizefield.