Net Callback
fun NetCallback(lifecycle: LifecycleOwner? = null, lifeEvent: Lifecycle.Event = Lifecycle.Event.ON_DESTROY)
Content copied to clipboard
Parameters
lifecycle
将Activity/Fragment/LifecycleOwner等作为参数传递会在其生命周期结束时自动取消网络请求. 避免内存泄漏
lifeEvent
指定自动取消的生命周期. 默认为Lifecycle.Event.ON_DESTROY