File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed
baselib/src/main/kotlin/wsdydeni/library/android/utils/lifecycle Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -36,6 +36,13 @@ inline fun Fragment.launchAndRepeatWithViewLifecycle(
3636 }
3737}
3838
39+ inline fun Fragment.launchAndRepeatWithViewLifecycle (
40+ minActiveState : Lifecycle .State = Lifecycle .State .STARTED ,
41+ crossinline block : suspend CoroutineScope .() -> Unit
42+ ) {
43+ launchAndRepeatWithViewLifecycle(Dispatchers .Main ,minActiveState,block)
44+ }
45+
3946/* *
4047 * 更加简洁的语法封装
4148 *
@@ -61,4 +68,11 @@ inline fun FragmentActivity.launchAndRepeatWithViewLifecycle(
6168 block()
6269 }
6370 }
71+ }
72+
73+ inline fun FragmentActivity.launchAndRepeatWithViewLifecycle (
74+ minActiveState : Lifecycle .State = Lifecycle .State .STARTED ,
75+ crossinline block : suspend CoroutineScope .() -> Unit
76+ ) {
77+ launchAndRepeatWithViewLifecycle(Dispatchers .Main ,minActiveState,block)
6478}
You can’t perform that action at this time.
0 commit comments