MingaEditor.State.ResourcePressure (Minga v0.1.0)

Copy Markdown View Source

Tracks frontend-reported macOS low power mode and thermal pressure.

The BEAM owns render pacing, so this state converts resource-pressure signals from native frontends into a minimum render debounce. Normal operation remains at the caller-requested cadence.

Summary

Types

t()

Thermal pressure level reported by the native GUI frontend.

Functions

Returns the default no-pressure state.

Returns the minimum render debounce in milliseconds for the current pressure level.

Updates the current resource-pressure state.

Types

t()

@type t() :: %MingaEditor.State.ResourcePressure{
  low_power?: boolean(),
  thermal_state: thermal_state()
}

thermal_state()

@type thermal_state() ::
  :nominal | :fair | :serious | :critical | {:unknown, non_neg_integer()}

Thermal pressure level reported by the native GUI frontend.

Functions

new()

@spec new() :: t()

Returns the default no-pressure state.

render_delay_ms(resource_pressure)

@spec render_delay_ms(t()) :: non_neg_integer()

Returns the minimum render debounce in milliseconds for the current pressure level.

update(state, low_power?, thermal_state)

@spec update(t(), boolean(), thermal_state()) :: t()

Updates the current resource-pressure state.