improve docs of launchOnShow/launchOnceOnShow

GitOrigin-RevId: e6cb14dad9e37e02e93cb585591dfad24ec9fb30
This commit is contained in:
Daniil Ovchinnikov
2025-04-09 14:31:48 +00:00
committed by intellij-monorepo-bot
parent 3b9005b70d
commit bb5eefd18d
@@ -27,13 +27,12 @@ import kotlin.coroutines.EmptyCoroutineContext
* and cancels the coroutine when the UI component is hidden.
* In particular, the component becomes hidden when it's removed from the hierarchy.
*
* The [block] may be executed at most one time.
* The [block] is executed with the modality state of the [component][this].
* This means that the [block] execution might happen in a different EDT event,
* because it has to wait for the proper modality.
*
* Cancellation of the returned Job brings back the state before calling this function,
* for instance, the Swing listener is removed.
* The [block] may be executed at most **one time**.
* It will not be restarted if canceled by the component becoming hidden.
*
* @param debugName name to use as [CoroutineName]
* @param context additional context of the coroutine.
@@ -77,12 +76,11 @@ fun <C : Component> C.launchOnceOnShow(
* The [block] is executed with the modality state of the [component][this].
* This means that the [block] execution might happen in a different EDT event,
* because it has to wait for the proper modality.
*
* The [block] may be executed several times, and the next execution of [block] will start after the previous [block] completes.
* This also means that the next [block] execution might happen in a different EDT event,
* because it has to [wait for the completion][Job.join] of a previously scheduled one.
* because it has to [wait for the completion][Job.join] of a previously scheduled [block].
*
* Cancellation of the returned Job brings back the state before calling this function,
* for instance, the Swing listener is removed.
* Exceptions from the [block] don't cancel the returned Job.
* If [block] throws an exception, it will be re-launched the next time the component becomes showing.
*