Skip to content

Commit

Permalink
Added start method to EventListener (slackhq#398)
Browse files Browse the repository at this point in the history
Adding `start` method to `EventListener` interface
  • Loading branch information
kierse authored Jan 18, 2023
1 parent e11e7f0 commit 49778a5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,10 @@ internal fun CircuitContent(
remember(screen, context) {
circuitConfig.eventListenerFactory?.create(screen, context) ?: EventListener.NONE
}
DisposableEffect(screen, context) { onDispose { eventListener.dispose() } }
DisposableEffect(screen, context) {
eventListener.start()
onDispose { eventListener.dispose() }
}

eventListener.onBeforeCreatePresenter(screen, navigator, context)
@Suppress("UNCHECKED_CAST")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ public interface EventListener {
/** Called once after the [Ui.Content] composition is disposed. */
public fun onDisposeContent() {}

/** Called once before doing any processing for the requested circuit. */
public fun start() {}

/**
* Called once when this [EventListener] should be disposed and the corresponding circuit is
* disposed.
Expand Down

0 comments on commit 49778a5

Please sign in to comment.