SnapshotNotifier

The different snapshot notification modes of Molecule.

Compose uses snapshots to provide a consistent view of state. Mutations to state outside of the composition are not automatically observed, and notifications of changes must be manually sent. This can be achieved by registering a global write observer, for which you need at-minimum one per process. Applications which use other Compose-based systems like Compose UI likely already have one in place, whereas applications that only use Molecule need its automatic registering of this notifier.

On the JVM and Android, Molecule will read the app.cash.molecule.snapshotNotifier system property in order to determine the default mechanism. The value is parsed with enumValueOf, or else defaults to WhileActive if not set or the property does not parse to a value.

See also

Entries

Link copied to clipboard

Rely on some other external system for sending snapshot change notifications.

Link copied to clipboard

Register a global snapshot write observer and send apply notifications when new writes occur using a coroutine launched on the same scope as the composition. This coroutine will be canceled and observer unregistered when that scope is canceled.

Properties

Link copied to clipboard

Returns a representation of an immutable list of all enum entries, in the order they're declared.

Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard

Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Link copied to clipboard

Returns an array containing the constants of this enum type, in the order they're declared.