From d0e06ba6a08963ac85535f88daff805bb0dcbca1 Mon Sep 17 00:00:00 2001 From: Jesse Wilson Date: Thu, 18 Jan 2024 21:39:55 -0500 Subject: [PATCH] ziplineCreated event also --- .../kotlin/app/cash/redwood/treehouse/EventListener.kt | 9 +++++++++ .../app/cash/redwood/treehouse/RealEventPublisher.kt | 6 ++++++ 2 files changed, 15 insertions(+) diff --git a/redwood-treehouse-host/src/commonMain/kotlin/app/cash/redwood/treehouse/EventListener.kt b/redwood-treehouse-host/src/commonMain/kotlin/app/cash/redwood/treehouse/EventListener.kt index b8673b7541..9910a2aaa2 100644 --- a/redwood-treehouse-host/src/commonMain/kotlin/app/cash/redwood/treehouse/EventListener.kt +++ b/redwood-treehouse-host/src/commonMain/kotlin/app/cash/redwood/treehouse/EventListener.kt @@ -40,6 +40,15 @@ public open class EventListener { */ public open fun codeLoadStart(): Any? = null + /** + * Invoked when a Zipline is created, after [codeLoadStart] and before any application code is + * loaded. + */ + public open fun ziplineCreated( + zipline: Zipline, + ) { + } + /** * Invoked when code is successfully downloaded and initialized. * diff --git a/redwood-treehouse-host/src/commonMain/kotlin/app/cash/redwood/treehouse/RealEventPublisher.kt b/redwood-treehouse-host/src/commonMain/kotlin/app/cash/redwood/treehouse/RealEventPublisher.kt index 3654a59f22..d8a3f15eca 100644 --- a/redwood-treehouse-host/src/commonMain/kotlin/app/cash/redwood/treehouse/RealEventPublisher.kt +++ b/redwood-treehouse-host/src/commonMain/kotlin/app/cash/redwood/treehouse/RealEventPublisher.kt @@ -43,6 +43,12 @@ internal class RealEventPublisher( return listener.codeLoadStart() } + override fun ziplineCreated( + zipline: Zipline, + ) { + listener.ziplineCreated(zipline) + } + override fun applicationLoadSuccess( applicationName: String, manifestUrl: String?,