Giter Site home page Giter Site logo

Comments (6)

mdiep avatar mdiep commented on June 18, 2024 4

No, I think it's the first flattened signal to send an event.

let (s1, o1) = Signal.pipe()
let (s2 o2) = Signal.pipe()
let (s3, o3) = Signal.pipe()

Signal(values: s1, s2, s3)
    .flatten(.first)
   .observeValues { print($0) }

o3.send(value: 7) // s3 becomes the chosen signal and its values are used

It makes sense to me as a possible strategy, but I'm not sure what you'd use it for.

from reactiveswift.

inamiy avatar inamiy commented on June 18, 2024 2

@RuiAAPeres Not yet, but I will tackle on this soon :)

from reactiveswift.

NachoSoto avatar NachoSoto commented on June 18, 2024

Wouldn't that be equivalent to

nestedSignal
  .take(1)
  .flatten(.Merge) // or anything else

from reactiveswift.

inamiy avatar inamiy commented on June 18, 2024

One example would be func timeout that can be re-implemented like this:

public func timeout(after interval: TimeInterval, raising error: Error, on scheduler: DateSchedulerProtocol) -> SignalProducer<Value, Error> {
    return SignalProducer(values: [
        self, 
        SignalProducer(error: error).delayError(interval, on: scheduler)
    ]).flatten(.first)
}
// NOTE: `delayError` doesn't exist yet

from reactiveswift.

RuiAAPeres avatar RuiAAPeres commented on June 18, 2024

@inamiy any progress on this? 😊

from reactiveswift.

andersio avatar andersio commented on June 18, 2024

Implemented in #233.

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.