Code Monkey home page Code Monkey logo

Comments (8)

liangjingkanji avatar liangjingkanji commented on August 21, 2024 1

都叫scopeNetLife了肯定要跟随ViewModel生命周期, 这是简单的基础

from net.

liangjingkanji avatar liangjingkanji commented on August 21, 2024

能fork仓库复现或者证明此问题吗?

麻烦提供代码, 因为我并不能复现此问题, 并且程序怎么存在随机

from net.

TxcA avatar TxcA commented on August 21, 2024

Life的话,考虑是否被Lifecycle cancel() 了?
这个要看你调用处的源码


lifecycleOwner?.lifecycle?.addObserver(object : LifecycleEventObserver {
override fun onStateChanged(source: LifecycleOwner, event: Lifecycle.Event) {
if (lifeEvent == event) cancel()
}
})

from net.

Lyphy999 avatar Lyphy999 commented on August 21, 2024
image

代码就是 直接 调用 当前 ViewModel 的该扩展 函数,刚 debug跑了, 后面调到 NetCoroutineScope 类的 launch 函数,不会执行:
Uploading image.png…

from net.

Lyphy999 avatar Lyphy999 commented on August 21, 2024
image

代码就是 直接 调用 当前 ViewModel 的该扩展 函数,刚 debug跑了, 后面调到 NetCoroutineScope 类的 launch 函数,不会执行:
image

from net.

liangjingkanji avatar liangjingkanji commented on August 21, 2024

ViewModel也有生命周期

from net.

Lyphy999 avatar Lyphy999 commented on August 21, 2024

ViewModel也有生命周期

onCrear()后, 是在哪处理了 不再执行 launch 了?,系统处理的吗?

from net.

liangjingkanji avatar liangjingkanji commented on August 21, 2024

ViewModel.onClear()后代表ViewModel生命周期结束, 不执行很正常, 除非你不使用ViewModel.scopeNetLife

from net.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.