miso
Copyright(C) 2016-2026 David M. Johnson
LicenseBSD3-style (see the file LICENSE)
MaintainerDavid M. Johnson <code@dmj.io>
Stabilityexperimental
Portabilitynon-portable
Safe HaskellNone
LanguageHaskell2010

Miso.Runtime.Internal

Description

Overview

Miso.Runtime.Internal is a testing-only facade that re-exports the miso runtime's global mutable state from Miso.Runtime.

Do not import this module in application code. Mutating any of the exported IORef values will corrupt the component lifecycle and produce undefined behaviour. The module exists solely to give the miso-tests integration-test package direct access to component state for assertions.

Exported names

See also

  • Miso.Runtime — the authoritative definitions of everything exported here
  • Miso.Reload — uses these internals to kill and restart the scheduler on :r
Synopsis

Documentation

components :: IORef (IntMap (ComponentState parent props model action)) Source #

componentMap

This is a global Component Map that holds the state of all currently mounted Components

componentIds :: IORef Int Source #

The global store of ComponentId, for internal-use only.

Used internally freshComponentId to allocate new ComponentId on mount.

rootComponentId :: ComponentId Source #

This is used to demarcate the ROOT of a page. This ID will *never* exist in the components map.

data ComponentState parent props model action Source #

Component state, data associated with the lifetime of a Component

Constructors

ComponentState 

Fields

schedulerThread :: IORef ThreadId Source #

Global variable to hold the scheduler thread

N.B. undefined is safe here, it will always get populated. Also, we use this in cleanup when interactive mode (GHCi) is detected in that circumstance schedulerThread will always be populated. It's an invariant.