GithubHelp home page GithubHelp logo

Comments (7)

mdiep avatar mdiep commented on April 28, 2024

This is because of how SignalProducer.init(value:) works. It sends the value immediately.

It goes something like this.

  1. Call starting
  2. Call SignalProducer to start
    1. init(value:) sends a value (value) and then completes (completed)
  3. Call started

from reactiveswift.

gkaimakas avatar gkaimakas commented on April 28, 2024

@mdiep This is quite confusing. I have observed the same behaviour on MutableProperty

from reactiveswift.

andersio avatar andersio commented on April 28, 2024

started is invoked after the starting side effect is done. So you would exhibit the same behaviour in any producer that sends events synchronously in the start handler.

@mdiep Perhaps started should not be invoked if the produced signal is terminated in the start handler. Any thoughts?

from reactiveswift.

mdiep avatar mdiep commented on April 28, 2024

I think it'd be more surprising for started to not always fire.

from reactiveswift.

gkaimakas avatar gkaimakas commented on April 28, 2024

Shouldn't started fire after starting?

from reactiveswift.

andersio avatar andersio commented on April 28, 2024

Yes in order, but it need not be immediate.

started is invoked after the starting side effect is done.

Look at the signature of SignalProducer.init(_:). It accepts a startHandler that is passed an observer. This means events can be sent as part of the starting side effect. started just indicates the side effect has completed, and it is invoked after startWithSignal (which in turn invokes the start handler) returns.

Note that starting is the good old started in RAC 4.x.

from reactiveswift.

mdiep avatar mdiep commented on April 28, 2024

Maybe this will help you make sense of it: the signal completed before it finished starting.

from reactiveswift.

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.