module
UI::DesignTokens::Device
Overview
Access point for the live device metrics provider.
UI::DesignTokens::Device.current returns the current
DeviceMetrics snapshot by calling the renderer-installed
provider; specs that want a deterministic value reset to the
spec-time fallback via Device.reset_provider.
Extended Modules
Defined in:
ui/design_tokens.crInstance Method Summary
- #current : DeviceMetrics
-
#install_provider(&block : -> DeviceMetrics) : Nil
Renderer-only entry point.
-
#reset_provider : Nil
Reset to the spec-time fallback.
Instance Method Detail
def install_provider(&block : -> DeviceMetrics) : Nil
#
Renderer-only entry point. UIKit / AppKit / Web renderers call this once on initialize to wire up a live OS-querying provider. The block returns the current metrics on every call (so consumers get fresh values on window resize / orientation change).
def reset_provider : Nil
#
Reset to the spec-time fallback. Used by specs that need to restore deterministic metrics after a renderer install.