view

open override fun view(lifetime: Lifetime, handler: (Lifetime, T) -> Unit)

Adds a subscription to changes of the contents of the object.

Every time the contents changes (e.g. the value of a property changes, or an object is added to a collection), the handler is called receiving the new contents. The Lifetime instance passed to the handler expires when the value is no longer part of the contents (e.g. the value of a property changes to something else, or the object is removed from the collection).

The subscription is removed when the given lifetime expires.