EffectHandler

Manages the execution and update of effects within a ComponentTree.

For Spec Components, this will invoke OnAttached when a component is attached to the ComponentTree and OnDetached when a component is detached from the tree.

For Kotlin components, this will handle dispatching callbacks registered with the useEffect hook.

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
abstract val effects: Collection<Effect>?

Functions

Link copied to clipboard
open fun hasReadsFor(updatedState: Set<StateId>): Boolean

Whether any currently-attached effect recorded a read of any of updatedState.

Link copied to clipboard
abstract fun onCleanup()

Removes all associated Effects and any transient state.

Link copied to clipboard
inline fun EffectHandler.updateAndRun(context: EffectContext, newEffects: List<Effect>?, onUpdate: () -> Unit)
Link copied to clipboard
abstract fun EffectContext.updateEffects(effects: List<Effect>?): Runnable

Updates the set of effects within the associated ComponentTree.