@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
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
Example
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
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
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
MaybePromise<Element>
options?
MaybePromise<IntersectionObserverInit>
Returns
Atom<boolean>
Example
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
MaybePromise<string>
Returns
Atom<boolean>
Example
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
MaybePromise<Element>
options?
MaybePromise<MutationObserverInit>
Returns
Atom<MutationRecord[]>
Example
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
Example
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
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
MaybePromise<HTMLElement>
Returns
Atom<{ width: number; height: number; }>
Example
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
Example
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
const clicks = on('click', document);
const battery = on('battery');
const matches = on('mediaQuery', '(min-width: 600px)');
const resized = on('resize', element);