ComputedObservable<T>
Defined in: src/lib/observable/observable.ts:346
Computed observable that derives its value from other observables. Read-only - value is computed from sources.
Type Parameters
| Type Parameter | Description |
|---|---|
T | The type of computed value |
Implements
Constructors
Constructor
new ComputedObservable\<T\>(
id: string,
compute: () => T,
sources: ReadonlyObservable<unknown>[]): ComputedObservable\<T\>;Defined in: src/lib/observable/observable.ts:358
Create a computed observable.
Parameters
| Parameter | Type | Description |
|---|---|---|
id | string | Unique identifier |
compute | () => T | Function that computes the value from sources |
sources | ReadonlyObservable<unknown>[] | Source observables to watch |
Returns
ComputedObservable<T>
Accessors
id
Get Signature
get id(): string;Defined in: src/lib/observable/observable.ts:377
The unique identifier of this observable.
Returns
string
The unique identifier of this observable.
Implementation of
isDisposed
Get Signature
get isDisposed(): boolean;Defined in: src/lib/observable/observable.ts:385
Returns
boolean
Implementation of
value
Get Signature
get value(): T;Defined in: src/lib/observable/observable.ts:381
The current value.
Returns
T
The current value.
Implementation of
Methods
[dispose]()
dispose: void;Defined in: src/lib/observable/observable.ts:418
Returns
void
Implementation of
IDisposable.[dispose]dispose()
dispose(): void;Defined in: src/lib/observable/observable.ts:408
Dispose of the computed observable and unsubscribe from sources.
Returns
void
Implementation of
pipe()
pipe\<U\>(source: ReadonlyObservable\<U\>, transform?: (value: U) => T): Subscription;Defined in: src/lib/observable/observable.ts:393
Subscribe to another observable, updating this one when it changes. Creates a one-way binding from source to this observable.
Type Parameters
| Type Parameter |
|---|
U |
Parameters
| Parameter | Type | Description |
|---|---|---|
source | ReadonlyObservable<U> | The source observable to subscribe to |
transform? | (value: U) => T | Optional transform function |
Returns
Subscription that can be disposed to unsubscribe
Implementation of
subscribe()
subscribe(callback: SubscriptionCallback\<T\>): Subscription;Defined in: src/lib/observable/observable.ts:389
Subscribe to value changes.
Parameters
| Parameter | Type | Description |
|---|---|---|
callback | SubscriptionCallback<T> | Function called when value changes |
Returns
Subscription that can be disposed to unsubscribe