# life

fun life(lifecycleOwner: LifecycleOwner, lifeEvent: Lifecycle.Event = Lifecycle.Event.ON_STOP): Interval
Content copied to clipboard

自动在指定生命周期后取消cancel轮询器

## Parameters

lifecycleOwner

生命周期持有者, 一般为Activity/Fragment

lifeEvent

取消轮询器的时机, 默认为 ON_STOP 界面停止时停止轮询器

fun life(activity: FragmentActivity): Interval
Content copied to clipboard

自动在指定生命周期后取消cancel轮询器 销毁生命周期为Lifecycle.Event.ON_DESTROY

fun life(fragment: Fragment): Interval
Content copied to clipboard

自动在指定生命周期后取消cancel轮询器 销毁生命周期为Lifecycle.Event.ON_STOP. 因为Fragment多数情况下不会触发Fragment.onDestroy