interface / @typed/fx

RefSubject.HydrationElement

Defines the hydration element state contract.

Package version
2.0.0-beta.13
Category
Hydration protocol
Since
2.0.0
Member of
RefSubject

Import

import { RefSubject } from "@typed/fx";

Access RefSubject.HydrationElement through the imported RefSubject export. Its declaration below describes the member.

This public exposure is a re-export. Its import path is supported; declaration documentation is shared with the other public exposures below.

Signatures

export interface HydrationElement {
    getAttribute(name: string): string | null;
    setAttribute(name: string, value: string): void;
    removeAttribute(name: string): void;
}

Why

Defines the minimal standards-based attribute surface required to restore state, allowing DOM elements and compatible hosts to participate.

Ownership and lifetime

HydrationElement is a contract and performs no acquisition. Implementations retain the errors, services, interruption, and Scope requirements expressed by its members.

Method: getAttribute

Reads an encoded hydration attribute from the host.

Method: getAttribute: Why

Reads the serialized payload from the host during client restoration.

Method: getAttribute: Ownership and lifetime

This declaration acquires no resources. Effects represented by the contract retain their own services and Scope requirements.

Method: removeAttribute

Removes a consumed hydration attribute from the host.

Method: removeAttribute: Why

Removes consumed hydration data so it cannot be restored twice from stale markup.

Method: removeAttribute: Ownership and lifetime

This declaration acquires no resources. Effects represented by the contract retain their own services and Scope requirements.

Method: setAttribute

Writes an encoded hydration attribute to the host.

Method: setAttribute: Why

Writes a server-produced hydration payload through the host’s native attribute contract.

Method: setAttribute: Ownership and lifetime

This declaration acquires no resources. Effects represented by the contract retain their own services and Scope requirements.

Other public imports

These import paths expose the same declaration. Each page retains its own public name and signature.

Source