Skip to content

PositionReadablePort

export interface PositionReadablePort extends SnapshotPort {
position(): Readonly<[number, number]>;
}

A port providing 2D coordinates (x, y). Used when expressing coordinates as a pair value, such as pointer position or DOM element position.

MethodDescription
position()Returns the [x, y] coordinates at the time of snapshot

Must inherit from SnapshotPort. When snapshot() is called, the port must capture the coordinate tuple at that moment and maintain it internally. Within a single tick, position() must return the same array object (equivalent by ===). If coordinates don’t change, the same reference may be returned across multiple snapshots.