Code Monkey home page Code Monkey logo

Comments (8)

WiKi123 avatar WiKi123 commented on May 30, 2024

flattens是一种降阶的操作。比如信号A (a1, a2,a3..)在执行中,信号B执行了 b1,b2。
我们暂且当成两个线程理解,以时间为参考,假如结果是 a1 ,b1,a2,a3,b2 , flatten后的结果就是这么一条线。

from reactivecocoa_use.

WiKi123 avatar WiKi123 commented on May 30, 2024

switchToLatest是执行最新的信号,信号A中a1,a2执行,在a1结束后,信号b1在a2开始执行前执行,在b1执行期间a2执行,然后b1结束。switchToLatest操作后,结果就是a1, b1 ,把a2过滤了。

from reactivecocoa_use.

WiKi123 avatar WiKi123 commented on May 30, 2024

@huangxianhui001 二者虽然都是降阶操作,但是方式是不同的。flattens直接粗暴,一条线执行。switchToLatest内部还要考虑信号的开始和执行问题。

from reactivecocoa_use.

huangxianhui001 avatar huangxianhui001 commented on May 30, 2024

@WiKi123 可以考虑加个 demo 演示一下两者的区别

from reactivecocoa_use.

WiKi123 avatar WiKi123 commented on May 30, 2024

@huangxianhui001 你可以选中列表中那个方法,点击右上角图片按钮。那样看起来比较清晰。里面是图文解释的。

from reactivecocoa_use.

huangxianhui001 avatar huangxianhui001 commented on May 30, 2024

很不巧,RACCommand的几个例子都没有图片

from reactivecocoa_use.

WiKi123 avatar WiKi123 commented on May 30, 2024

最下面关于flattens和switchToLatest是有图片的。

from reactivecocoa_use.

huangxianhui001 avatar huangxianhui001 commented on May 30, 2024

赞,看到了

from reactivecocoa_use.

Related Issues (2)

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.