Skip to content

@epikodelabs/streamix


@epikodelabs/streamix / dom/src/public-api / on

Function: on() ​

Creates a reactive stream for a DOM or browser event source.

on is a single entry point that dispatches to the appropriate DOM adapter based on the requested source type.

Call Signature ​

on(type): Atom<number>

Defined in: projects/libraries/streamix/dom/src/lib/factories/on.ts:31

Creates a reactive stream for a DOM or browser event source.

on is a single entry point that dispatches to the appropriate DOM adapter based on the requested source type.

Parameters ​

type ​

"animationFrame"

Returns ​

Atom<number>

Example ​

ts
const clicks = on('click', document);
const battery = on('battery');
const matches = on('mediaQuery', '(min-width: 600px)');
const resized = on('resize', element);

Call Signature ​

on(type): Atom<BatteryState>

Defined in: projects/libraries/streamix/dom/src/lib/factories/on.ts:32

Creates a reactive stream for a DOM or browser event source.

on is a single entry point that dispatches to the appropriate DOM adapter based on the requested source type.

Parameters ​

type ​

"battery"

Returns ​

Atom<BatteryState>

Example ​

ts
const clicks = on('click', document);
const battery = on('battery');
const matches = on('mediaQuery', '(min-width: 600px)');
const resized = on('resize', element);

Call Signature ​

on(type): Atom<boolean>

Defined in: projects/libraries/streamix/dom/src/lib/factories/on.ts:33

Creates a reactive stream for a DOM or browser event source.

on is a single entry point that dispatches to the appropriate DOM adapter based on the requested source type.

Parameters ​

type ​

"fullscreen"

Returns ​

Atom<boolean>

Example ​

ts
const clicks = on('click', document);
const battery = on('battery');
const matches = on('mediaQuery', '(min-width: 600px)');
const resized = on('resize', element);

Call Signature ​

on(type, timeout?): Atom<IdleDeadline>

Defined in: projects/libraries/streamix/dom/src/lib/factories/on.ts:34

Creates a reactive stream for a DOM or browser event source.

on is a single entry point that dispatches to the appropriate DOM adapter based on the requested source type.

Parameters ​

type ​

"idle"

timeout? ​

number

Returns ​

Atom<IdleDeadline>

Example ​

ts
const clicks = on('click', document);
const battery = on('battery');
const matches = on('mediaQuery', '(min-width: 600px)');
const resized = on('resize', element);

Call Signature ​

on(type, element, options?): Atom<boolean>

Defined in: projects/libraries/streamix/dom/src/lib/factories/on.ts:35

Creates a reactive stream for a DOM or browser event source.

on is a single entry point that dispatches to the appropriate DOM adapter based on the requested source type.

Parameters ​

type ​

"intersection"

element ​

Element

options? ​

IntersectionObserverInit

Returns ​

Atom<boolean>

Example ​

ts
const clicks = on('click', document);
const battery = on('battery');
const matches = on('mediaQuery', '(min-width: 600px)');
const resized = on('resize', element);

Call Signature ​

on(type, query): Atom<boolean>

Defined in: projects/libraries/streamix/dom/src/lib/factories/on.ts:40

Creates a reactive stream for a DOM or browser event source.

on is a single entry point that dispatches to the appropriate DOM adapter based on the requested source type.

Parameters ​

type ​

"mediaQuery"

query ​

string

Returns ​

Atom<boolean>

Example ​

ts
const clicks = on('click', document);
const battery = on('battery');
const matches = on('mediaQuery', '(min-width: 600px)');
const resized = on('resize', element);

Call Signature ​

on(type, element, options?): Atom<MutationRecord[]>

Defined in: projects/libraries/streamix/dom/src/lib/factories/on.ts:41

Creates a reactive stream for a DOM or browser event source.

on is a single entry point that dispatches to the appropriate DOM adapter based on the requested source type.

Parameters ​

type ​

"mutation"

element ​

Element

options? ​

MutationObserverInit

Returns ​

Atom<MutationRecord[]>

Example ​

ts
const clicks = on('click', document);
const battery = on('battery');
const matches = on('mediaQuery', '(min-width: 600px)');
const resized = on('resize', element);

Call Signature ​

on(type): Atom<NetworkState>

Defined in: projects/libraries/streamix/dom/src/lib/factories/on.ts:46

Creates a reactive stream for a DOM or browser event source.

on is a single entry point that dispatches to the appropriate DOM adapter based on the requested source type.

Parameters ​

type ​

"network"

Returns ​

Atom<NetworkState>

Example ​

ts
const clicks = on('click', document);
const battery = on('battery');
const matches = on('mediaQuery', '(min-width: 600px)');
const resized = on('resize', element);

Call Signature ​

on(type): Atom<"portrait" | "landscape">

Defined in: projects/libraries/streamix/dom/src/lib/factories/on.ts:47

Creates a reactive stream for a DOM or browser event source.

on is a single entry point that dispatches to the appropriate DOM adapter based on the requested source type.

Parameters ​

type ​

"orientation"

Returns ​

Atom<"portrait" | "landscape">

Example ​

ts
const clicks = on('click', document);
const battery = on('battery');
const matches = on('mediaQuery', '(min-width: 600px)');
const resized = on('resize', element);

Call Signature ​

on(type, element): Atom<{ width: number; height: number; }>

Defined in: projects/libraries/streamix/dom/src/lib/factories/on.ts:48

Creates a reactive stream for a DOM or browser event source.

on is a single entry point that dispatches to the appropriate DOM adapter based on the requested source type.

Parameters ​

type ​

"resize"

element ​

HTMLElement

Returns ​

Atom<{ width: number; height: number; }>

Example ​

ts
const clicks = on('click', document);
const battery = on('battery');
const matches = on('mediaQuery', '(min-width: 600px)');
const resized = on('resize', element);

Call Signature ​

on(type): Atom<ViewportState>

Defined in: projects/libraries/streamix/dom/src/lib/factories/on.ts:52

Creates a reactive stream for a DOM or browser event source.

on is a single entry point that dispatches to the appropriate DOM adapter based on the requested source type.

Parameters ​

type ​

"viewportChange"

Returns ​

Atom<ViewportState>

Example ​

ts
const clicks = on('click', document);
const battery = on('battery');
const matches = on('mediaQuery', '(min-width: 600px)');
const resized = on('resize', element);

Call Signature ​

on(type): Atom<DocumentVisibilityState>

Defined in: projects/libraries/streamix/dom/src/lib/factories/on.ts:53

Creates a reactive stream for a DOM or browser event source.

on is a single entry point that dispatches to the appropriate DOM adapter based on the requested source type.

Parameters ​

type ​

"visibilityChange"

Returns ​

Atom<DocumentVisibilityState>

Example ​

ts
const clicks = on('click', document);
const battery = on('battery');
const matches = on('mediaQuery', '(min-width: 600px)');
const resized = on('resize', element);

Released under the MIT License.