-
Notifications
You must be signed in to change notification settings - Fork 627
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
popupwindow或者dialog里面的网络请求也要回调到UI层进行处理吗,感觉有点麻烦,能否直接在弹框里面请求网络呢 #115
Comments
建议试试协程网络请求同步写法例如Net, 没有回调 // 自动显示/关闭对话框
scopeDialog {
val result = Get<Data>("/api").await()
}
// 页面关闭自动取消
scopeNetLife {
val result = Post<Data>("/api").await()
} |
也可以自定义协程的扩展
|
扩展一点来讲,api接口是suspend关键字修饰的,只要可以开启协程都可以进行网络请求
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
No description provided.
The text was updated successfully, but these errors were encountered: