Skip to content
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

BaseViewModel里为什么又定义一个async方法? #7

Open
andev009 opened this issue Jul 18, 2020 · 1 comment
Open

BaseViewModel里为什么又定义一个async方法? #7

andev009 opened this issue Jul 18, 2020 · 1 comment

Comments

@andev009
Copy link

比如 val topArticleListDefferd = async {
popularRepository.getTopArticleList()
}
这个async又调用到BaseViewModel的async 方法,而BaseViewModel的async 方法又调用:
return viewModelScope.async { block.invoke() }
为什么要多转一道呢?

@yu893145181
Copy link

就是一个方法参数的传递啊,没啥影响,主要是创建了一个带返回值的协程

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants