Skip to content

@epikodelabs/streamix


@epikodelabs/streamix / src/public-api / Lens

Interface: Lens<T> ​

Defined in: projects/libraries/streamix/src/lib/factories/lens.ts:12

A writable, focused view of a source atom.

Extends ​

Type Parameters ​

T ​

T

Properties ​

type ​

readonly type: "atom"

Defined in: projects/libraries/streamix/src/lib/atoms/atom.ts:69

Runtime discriminator for atom-like values.

Inherited from ​

Readable.type


name? ​

readonly optional name?: string

Defined in: projects/libraries/streamix/src/lib/atoms/atom.ts:71

Optional human-readable name used by integrations and diagnostics.

Inherited from ​

Readable.name


value ​

readonly value: T

Defined in: projects/libraries/streamix/src/lib/atoms/atom.ts:73

Current value. Throws if the atom is currently in an error state.

Inherited from ​

Readable.value


safeValue ​

readonly safeValue: T

Defined in: projects/libraries/streamix/src/lib/atoms/atom.ts:75

Current value, returning the last safe value when the atom has errored.

Inherited from ​

Readable.safeValue


previous ​

readonly previous: T

Defined in: projects/libraries/streamix/src/lib/atoms/atom.ts:77

Previously emitted value.

Inherited from ​

Readable.previous


disposed ​

readonly disposed: boolean

Defined in: projects/libraries/streamix/src/lib/atoms/atom.ts:79

True after the atom has been disposed.

Inherited from ​

Readable.disposed


dirty ​

readonly dirty: boolean

Defined in: projects/libraries/streamix/src/lib/atoms/atom.ts:81

True when reactive work is queued but not flushed yet.

Inherited from ​

Readable.dirty


error? ​

readonly optional error?: any

Defined in: projects/libraries/streamix/src/lib/atoms/atom.ts:83

Last error captured by this atom, if any.

Inherited from ​

Readable.error


subscriberCount? ​

readonly optional subscriberCount?: number

Defined in: projects/libraries/streamix/src/lib/atoms/atom.ts:85

Number of active subscribers, when exposed by the implementation.

Inherited from ​

Readable.subscriberCount

Methods ​

subscribe() ​

subscribe(callback?): Subscription

Defined in: projects/libraries/streamix/src/lib/atoms/atom.ts:95

Subscribes to this atom's current state and future value changes.

If the atom already has a current value, the callback is invoked synchronously once with (current, previous) during subscription. Atoms that have not produced a value yet wait for their first emission. The returned subscription must be disposed when the listener is no longer needed.

Parameters ​

callback? ​

(current, previous) => any

Returns ​

Subscription

Inherited from ​

Readable.subscribe


onError() ​

onError(handler): Subscription

Defined in: projects/libraries/streamix/src/lib/atoms/atom.ts:97

Subscribes to atom errors.

Parameters ​

handler ​

(error) => void

Returns ​

Subscription

Inherited from ​

Readable.onError


dispose() ​

dispose(): void

Defined in: projects/libraries/streamix/src/lib/atoms/atom.ts:99

Stops the atom and releases all subscribers/resources.

Returns ​

void

Inherited from ​

Readable.dispose


[asyncIterator]() ​

[asyncIterator](): AsyncIterator<T>

Defined in: projects/libraries/streamix/src/lib/atoms/atom.ts:101

Iterates emitted values until the atom is disposed or iteration is closed.

Returns ​

AsyncIterator<T>

Inherited from ​

Readable.[asyncIterator]


set() ​

set(value): void

Defined in: projects/libraries/streamix/src/lib/factories/lens.ts:13

Parameters ​

value ​

T

Returns ​

void


next() ​

next(value): void

Defined in: projects/libraries/streamix/src/lib/factories/lens.ts:14

Parameters ​

value ​

T

Returns ​

void

Released under the MIT License.