Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Oct 08 17:02
    darcyparker commented #326
  • Oct 08 16:01
    staltz closed #326
  • Oct 08 16:01
    staltz commented #326
  • Oct 08 14:08
    darcyparker opened #326
  • Sep 08 07:10
    ftaiolivista commented #235
  • Sep 07 13:00
    ftaiolivista commented #235
  • Sep 06 15:21
    staltz commented #325
  • Sep 06 14:47
    ftaiolivista commented #325
  • Sep 06 14:38
    staltz commented #325
  • Sep 06 14:37
    staltz commented #325
  • Sep 06 14:30
    ftaiolivista edited #325
  • Sep 06 14:30
    ftaiolivista opened #325
  • Sep 01 10:38
    staltz closed #284
  • Sep 01 10:38
    staltz commented #284
  • Sep 01 02:14
    andykais commented #284
  • Aug 19 18:31
    nukisman edited #324
  • Aug 19 18:30
    staltz commented #324
  • Aug 19 18:20
    nukisman edited #324
  • Aug 19 18:18
    nukisman edited #324
  • Aug 19 18:17
    nukisman edited #324
Alex
@whitecolor
it is simple
Michal Vanko
@michalvankodev
I'm going to try this out ;)
Alex
@whitecolor
on this diagram secons + is a moment of arrival of second stream to metastream, not the time of subscribtion
Michal Vanko
@michalvankodev
It dropped all of the values emitted before.. there is no buffer for those
Alex
@whitecolor
if your second stream had subscribers before
Michal Vanko
@michalvankodev
yes ;)
André Staltz
@staltz
Yes this is a tricky thing, and also occurs with concatMap in RxJS, it depends whether the thing being concatted is hot or cold
the intuition is not exactly "concatenation of values", it's more about "sequential subscription to different streams"
that's why I like "flattenSequentially" as a name
Michal Vanko
@michalvankodev
Wise choice :) .. Yesterday I got a question from my colleague if something like what I asked for is possible.. to deal with the events in order would be possible via some operator.. I can only think of flattenConcurrently with some extra logic to delay events from streams that are emitted before the first one finishes
André Staltz
@staltz
probably requires some buffering, we haven't yet made buffer or toArray in xstream, but I think it's on the to-do list
Michal Vanko
@michalvankodev
Didn't something with mapTo() changed in xtream@11? I was generating new IDs with mapTo and the function I've mapped to was always called before I've updated dependencies the last time. Now that function is only called once
Nick Johnstone
@Widdershin
@michalvankodev can you share a code sample?
is it stream$.mapTo(generateId())?
Michal Vanko
@michalvankodev
yes exactly
I get it that it shouldn't work.. .But it worked before
Nick Johnstone
@Widdershin
 λ cat > test.js
const xs = require('xstream').default;

xs.of(1, 2, 3).mapTo(Math.random()).addListener({next: console.log})

 λ npx -p xstream@10 node test.js
npx: installed 2 in 2.063s
0.5104117713843652
0.5104117713843652
0.5104117713843652

 λ npx -p xstream@11 node test.js 
npx: installed 2 in 2.463s
0.07187050076072277
0.07187050076072277
0.07187050076072277
From what I understand, it wouldn't be possible for xstream to change this behaviour
Michal Vanko
@michalvankodev
Thanks.. this is interesting
Michal Vanko
@michalvankodev
Yea I am thinking that the cause might be onionify .. As it might always build the component over and over again when state changed
Nick Johnstone
@Widdershin
can just use map(generateId) in any case
it will do what you actually want
Michal Vanko
@michalvankodev
yes i Know :) ... I've changed it to that way.. I'm just curious why the behavior changed after update
Michal Vanko
@michalvankodev
just to be exact it was
stream$.mapTo(createSomething(generateId()))
André Staltz
@staltz
@michalvankodev I don't think anything changed with stream, map nor mapTo between xstream v10.9 and v11.0
maybe you were using xstream v10.x where x < 9 ?
Michal Vanko
@michalvankodev
I might.. haven't done rm node_modules so I guess npm could keep the older version
Victor Borja
@vic
Hello, is there an easy way to convert an Rxv5 stream into an xstream ? Should I use xs.fromObservable or perhaps rxv5$.subscribe(...) ?
Victor Borja
@vic
looks like xs.fromObservable(rxv5) worked
Michal Vanko
@michalvankodev
@vic Yes xs.fromObservable works.. even with higher order observables ;)
Guys I have a question. I want to do a reactive programming workshop in our company. I don't have much experience with RxJS. But I want that workshop to be useful for people. I think that teaching xstream is far more easier than RxJS as well. Should I focus only on xstream or do you think that xstream is not that useful outside of cycle js
André Staltz
@staltz
Hi @michalvankodev, good news! I think you should teach RxJS or most.js, because of the simpler internals
xstream is complicated, internally
but something like https://github.com/staltz/toy-rx is easy to show
often when teaching something, in order to explain "why are things like this" you will have to go into the internals, and RxJS is conceptually "cleaner" than xstream
Michal Vanko
@michalvankodev
I have no idea about xstream or rxjs internals :D
André Staltz
@staltz
take a look at toy-rx
it's really simple
Michal Vanko
@michalvankodev
Thanks, I'm looking into it ;)
That's not a bad idea how to start a workshop.. by building an Observable itself.
André Staltz
@staltz
I've done it many times and it's a good way of making people less scared of it
Michal Vanko
@michalvankodev
But do you believe that RxJS is easier to explain and learn than xstream?
André Staltz
@staltz
depends on the use case
if you're just going to use xstream basics, and you have 1 subscribe in your app, then yeah xstream
if you have 3+ subscribes, then RxJS
Michal Vanko
@michalvankodev
I will like to show off both of them and compare them anyway.. But want to have something to teach how higher order observables work and etc.
ok Thanks. :) I will have to learn RxJS then :D I am really interested why @ntilwalli likes it so much :D
André Staltz
@staltz
Or most.js for that matter : )
the big advantage of xstream is how it's multicast everywhere, and how that helps our goal to make cycle.js more visualizable