Skip to content

RatioReadablePort

export interface RatioReadablePort extends SnapshotPort {
readonly ratio: number; // 0..1
}

A port providing a dynamically computed ratio value between 0 and 1, based on inputs like position or size. Used when you need to convert values into a ratio, such as scroll position or element occupation ratio.

PropertyDescription
ratioA ratio value from 0.0 to 1.0

Must inherit from SnapshotPort. When snapshot() is called, the port must capture the value at that moment and maintain it internally, ensuring that ratio does not change until the next snapshot().