Skip to content

API reference > @kontsedal/olas-core > ReadSignal

ReadSignal type ​

Read-only reactive value. Reading .value inside a tracking scope (computed / effect) registers a dependency; peek() reads without tracking; subscribe(handler) fires handler immediately with the current value and on every change until the returned unsubscribe is called.

Signature:

typescript
type ReadSignal<T> = {
  readonly value: T;
  peek(): T;
  subscribe(handler: (value: T) => void): () => void;
  subscribeChanges(handler: (value: T) => void): () => void;
};

Released under the MIT License.