Skip to content

@epikodelabs/streamix


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

Interface: Writable<T>

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

Writable atom returned by atom.

Extends

Type Parameters

T

T = any

Properties

type

readonly type: "atom"

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

Runtime discriminator for atom-like values.

Inherited from

Atom.type


name?

readonly optional name: string

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

Optional human-readable name used by integrations and diagnostics.

Inherited from

Atom.name


value

readonly value: T

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

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

Inherited from

Atom.value


safeValue

readonly safeValue: T

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

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

Inherited from

Atom.safeValue


previous

readonly previous: T

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

Previously emitted value.

Inherited from

Atom.previous


disposed

readonly disposed: boolean

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

True after the atom has been disposed.

Inherited from

Atom.disposed


dirty

readonly dirty: boolean

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

True when an analog update is queued but not flushed yet.

Inherited from

Atom.dirty


error?

readonly optional error: any

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

Last error captured by this atom, if any.

Inherited from

Atom.error


subscriberCount?

readonly optional subscriberCount: number

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

Number of active subscribers, when exposed by the implementation.

Inherited from

Atom.subscriberCount

Methods

subscribe()

subscribe(callback?): Subscription

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

Subscribes to value changes.

The callback receives (current, previous). The returned subscription must be disposed when the listener is no longer needed.

Parameters

callback?

(current, previous) => any

Returns

Subscription

Inherited from

Atom.subscribe


onError()

onError(handler): Subscription

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

Subscribes to atom errors.

Parameters

handler

(error) => void

Returns

Subscription

Inherited from

Atom.onError


dispose()

dispose(): void

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

Stops the atom and releases all subscribers/resources.

Returns

void

Inherited from

Atom.dispose


[asyncIterator]()

[asyncIterator](): AsyncIterator<T>

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

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

Returns

AsyncIterator<T>

Inherited from

Atom.[asyncIterator]


next()

next(value): void

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

Emits a new value.

Parameters

value

T

Returns

void


set()

set(value): void

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

Alias for next.

Parameters

value

T

Returns

void


fail()

fail(err, options?): void

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

Puts the atom into an error state and notifies error handlers.

Parameters

err

any

options?
terminate?

boolean

Returns

void


recover()?

optional recover(): void

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

Clears a recoverable error state, when supported.

Returns

void


clearError()?

optional clearError(): void

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

Clears the stored error without emitting a value, when supported.

Returns

void

Released under the GNU AGPL v3 or later.