Skip to main content

ReadonlySignal

interface

A value you can read now and be told about later. The host hands these out for state it owns, so a mod never polls. Read `value` for the current data, call `subscribe` to be woken on every change, and call the returned function to stop listening.

interface ReadonlySignal<T>

Import

import { ReadonlySignal } from '@modular/sdk';

Members2

value
T

The value at this moment.

subscribe
(listener: (value: T) => void) => () => void

Run `listener` on every change. Call the result to unsubscribe.

Notes

category
Context