morph 0.1.0
Asynchronous bridge between GUI thread and business models
Loading...
Searching...
No Matches
morph::ui::Inspector Class Reference

The development inspector over one mounted screen: its mounted nodes, its queries and mutations, the command lists it ran, and the reactive runtime's counters. More...

#include <inspector.hpp>

Public Member Functions

std::string const & screenId () const noexcept
 The screen's document id.
std::vector< InspectedNode > nodes () const
 Every node of the screen whose scope is alive, in the order it was lowered (a parent before its children), each with its expression properties evaluated now.
std::vector< InspectedQuery > queries () const
 Every query and mutation of the screen's live scopes, the screen's own first, then those of the app document, with their state now.
std::vector< CommandLogEntry > commandLog () const
 The latest command lists the screen ran, oldest first, at most detail::kCommandLogSize.
reactive::RuntimeStats counters () const
 The reactive runtime's counters: flushes, Effects per flush, batches and misuses.
bool refetch (std::string_view query)
 Refetches a query by running the document command {"refetch": "<query>"} in the scope that declares it, as a user's event runs a command list: the same path, the same batch, the same log entry.

Static Public Member Functions

static std::optional< Inspector > over (Screen &screen)
 An inspector over screen, when its session records what an inspector reads.

Detailed Description

The development inspector over one mounted screen: its mounted nodes, its queries and mutations, the command lists it ran, and the reactive runtime's counters.

Every read returns a copy, so nothing it hands out writes the screen. The one thing it does to the screen is refetch, which runs the document command {"refetch": "<query>"} as a user's event would. Valid while the screen lives; use it on the runtime's owner.

Definition at line 70 of file inspector.hpp.

Member Function Documentation

◆ over()

std::optional< Inspector > morph::ui::Inspector::over ( Screen & screen)
inlinestaticnodiscard

An inspector over screen, when its session records what an inspector reads.

Parameters
screenThe screen; it outlives the inspector.
Returns
The inspector; nothing when the screen's session has DevelopmentTools::Off, which records nothing.

Definition at line 75 of file inspector.hpp.

◆ screenId()

std::string const & morph::ui::Inspector::screenId ( ) const
inlinenodiscardnoexcept

The screen's document id.

Returns
It.

Definition at line 84 of file inspector.hpp.

◆ nodes()

std::vector< InspectedNode > morph::ui::Inspector::nodes ( ) const
inlinenodiscard

Every node of the screen whose scope is alive, in the order it was lowered (a parent before its children), each with its expression properties evaluated now.

A node is listed once per scope it was lowered in, so a row's nodes are listed once per row. A switch's default and a custom node's fallback are lowered in their enclosing scope, so they are listed whether or not they are shown. An evaluation the inspector makes reports no diagnostic.

Returns
The nodes.

Definition at line 93 of file inspector.hpp.

◆ queries()

std::vector< InspectedQuery > morph::ui::Inspector::queries ( ) const
inlinenodiscard

Every query and mutation of the screen's live scopes, the screen's own first, then those of the app document, with their state now.

A query is idle with no cache entry (its when is not true, its alias is unbound or its body is null), and with an entry that has neither a value nor a request; pending while a request is in flight; error when the last request failed; stale when its entry was invalidated or its value is at least staleTime old; fresh otherwise. A mutation is pending while a run is in flight or queued, error when its last run failed, fresh once a run succeeded, and idle before any.

Returns
The queries and mutations.

Definition at line 128 of file inspector.hpp.

◆ commandLog()

std::vector< CommandLogEntry > morph::ui::Inspector::commandLog ( ) const
inlinenodiscard

The latest command lists the screen ran, oldest first, at most detail::kCommandLogSize.

Returns
Each list's event, its commands and its batch.

Definition at line 144 of file inspector.hpp.

◆ counters()

reactive::RuntimeStats morph::ui::Inspector::counters ( ) const
inlinenodiscard

The reactive runtime's counters: flushes, Effects per flush, batches and misuses.

Returns
They.

Definition at line 151 of file inspector.hpp.

◆ refetch()

bool morph::ui::Inspector::refetch ( std::string_view query)
inline

Refetches a query by running the document command {"refetch": "<query>"} in the scope that declares it, as a user's event runs a command list: the same path, the same batch, the same log entry.

Parameters
queryThe query's name, as queries() lists it.
Returns
Whether a live scope of the screen declares a query of that name.

Definition at line 157 of file inspector.hpp.


The documentation for this class was generated from the following file: