We use a similar approach in our project. Lifecycle-aware classes emit corresponding events from their callback methods. And so we can declare lifecycle-bound entities like this:
Copy code
private val chatEventsRange
by bindToLifecycle(LifecycleInterval.VIEW_CREATED) {
streamModel.acquireChatEventsRange(CHAT_PAGE_SIZE)
}