Class Responsive<T>

Applies different property values based on viewport and device.

Pass a Module instance or a plain object as the source and a list of rules. When the active breakpoint set changes, matching rule props are merged and applied (via updateProps() for modules).

Listens to vevet.onResize('any') and re-evaluates rules on viewport changes. When the source is a Module, Responsive is destroyed automatically on module destroy.

Type Parameters

Hierarchy

  • Destroyable
    • Responsive

Constructors

Accessors

Methods

Constructors

Accessors

  • get isDestroyed(): boolean

    Indicates whether the instance has been destroyed.

    After destruction, destroy is a no-op.

    Returns boolean

  • get props(): TResponsiveProps<T>

    Current merged props (baseline + active rules).

    Read-only snapshot. For Module sources, mirrors source.props after responsive updates.

    Returns TResponsiveProps<T>

Methods

  • Subclass hook for internal cleanup.

    Called at the start of destroy, before registered onDestroy actions run.

    Returns void

  • Destroys the instance and runs all registered cleanup actions.

    Safe to call multiple times; subsequent calls are ignored.

    Execution order:

    1. _destroy
    2. all onDestroy callbacks, in registration order
    3. isDestroyed is set to true

    Returns void

  • Registers a function to run when the instance is destroyed.

    If the instance is already destroyed, action runs immediately.

    Parameters

    • action: () => void

      Cleanup function (for example remove listeners or DOM classes).

    Returns void