register Global Write Observer
fun registerGlobalWriteObserver(observer: SnapshotWriteObserver): () -> Unit
Content copied to clipboard
Register an observer of the first write to the global state of a global state object since the last call to sendApplyNotifications.
Composition uses this to schedule a new composition whenever a state object that was read in composition is modified.
State objects can be sent to the apply observer that have not been sent to global write observers. This happens for state objects inside MutableSnapshot that is later applied by calling MutableSnapshot.apply.
This should only be used to determine if a call to sendApplyNotifications should be scheduled to be called.
Return
a lambda that, when called, unregisters observer.