Skip to content

SignalSvc type

Home > @rimitive/react > SignalSvc

Minimal service interface used by React bindings. Contains the core methods for creating and managing signals.

Signature:

export type SignalSvc = {
signal: <T>(value: T) => Writable<T>;
computed: <T>(compute: () => T) => Readable<T>;
effect: (fn: () => void | (() => void)) => () => void;
batch: <T>(fn: () => T) => T;
dispose: () => void;
};

References: Writable, Readable

import { compose } from '@rimitive/core';
import { SignalModule, ComputedModule, EffectModule, BatchModule } from '@rimitive/signals/extend';
const svc: SignalSvc = compose(SignalModule, ComputedModule, EffectModule, BatchModule);