Skip to content

quickmodel / IQModelSignal

Interface: IQModelSignal<T> ​

Public interface for the built-in signal exposed by QModel.$qSignal.

Type Parameters ​

T ​

T extends IQModelSubscribable

The concrete QModel subclass type.

Methods ​

peek() ​

peek(): T

Returns the model instance without registering any reactive dependency. Safe to call from any context, including inside framework effects.

Returns ​

T


subscribe() ​

subscribe(callback): () => void

Registers a callback that fires after each property change.

Parameters ​

callback ​

IQObserverFn

Returns ​

An unsubscribe function — call it to stop receiving notifications.

() => void

Example ​

typescript
const unsub = model.$qSignal.subscribe(({ field, next }) => {
  console.log(`${field} →`, next);
});
// Later:
unsub();

Properties ​

version ​

readonly version: number

Monotonically increasing counter. Starts at 0 and increments once for every property change, regardless of whether any observers are registered.

Frameworks that track dependency by "version number" (e.g. custom Vue refs, Preact signals) can read this property to invalidate derived computations.