Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
André Staltz
@staltz
But withLatestFrom is not so frequently used as the others, and we could just do map+map+flatten
fenduru
@fenduru
@staltz unfortunately I have only been able to use cycle.js for toy projects, but while trying to incorporate FRP into my work projects, I've found myself using withLatestFrom quite a bit. However I think I should have been using a reducer pattern in those cases instead /shrug
Alex
@whitecolor
Tylor Steinberger
@TylorS
Alex
@whitecolor
would this be: HTTP.flatMap(r$ => r$.catch(O.empty())) the only correct mechanics to get stream of only successful responses, do you use such approach?
Steve Lee
@SteveALee
I also ended up using withLatestFrom in my app as I gravitated to single state atom and yiu need to it get it on an unser event. I plan to change that though. I agree light is the way to go. While withLatestFrom could be added to extras, there's nothing to stop us creating a utility function. or even add it as an operator in our project if we really want to.
But this highlights that need for a resource of common patterns / idioms
@staltz so 'one' to going hot only :)
Thomas Belin
@atomrc
Hey, do you have any idea how I can get the last produced value of a not completed stream ?
is it even possible?
the underlining problem is when I am doing unit testing on my components. I have a component that depends on a continuous stream (DOM events typically) and I just want to test the last value of the vtree, how can I do that?
Maybe the answer is simply: I must only produce a single value when I am unit testing. I guess that's the path I am going to take right now ...
Alex
@whitecolor
what do you mean by "last of not completed"
Thomas Belin
@atomrc
to be honest, I am not even sure why my component is producing 2 vtrees for my test
@whitecolor well I think I am not able to really think in the "observable mode" yet, so the concept of "last produced value of a not completed stream" would be the last value that has been produced when something is subscribing :s
what I am saying sounds awful :D
maybe the way to do that is to just skip the nfirst uninteresting values?
Alex
@whitecolor
is it a hot stream?
Thomas Belin
@atomrc
well if DOM.select('.selector').events('click') is hot, then mine is hot
Tylor Steinberger
@TylorS
@atomrc All of the @cycle/dom tests use .skip(1).take(1)
Thomas Belin
@atomrc
@TylorS oh interesting indeed :)
And every other line where there is a .subscribe()
Thomas Belin
@atomrc
what is the take(1) for ?
Alex
@whitecolor
takes only one)
Thomas Belin
@atomrc
so it's just to be sure you only play the subscribe once
fenduru
@fenduru
@atomrc if you have a stream --a--b--c-- and you call take(1) it will turn it into --a--|
oh - you were asking in that particular context. ignore me
Tushar Mathur
@tusharmath
Quick question people. Is there a way to integrate HTML5 audio/video tags using cyclejs/
?
Alex
@whitecolor
quick answer: yes
Tushar Mathur
@tusharmath
@whitecolor another quick question — how?
Alex
@whitecolor
it depends on your task
Tushar Mathur
@tusharmath
I am building a music player
Alex
@whitecolor
if you need just tags just put them using cycle/dom
Tushar Mathur
@tusharmath
So I search for a song using the Sound Cloud API
Alex
@whitecolor
if you need to manage Audio you should do it via driver
Tushar Mathur
@tusharmath
it returns a url
the problem is with changing songs
changing the URL of the Audio tag doesn't change the song
Alex
@whitecolor
try to set prop not the attribute
or you may have to use hooks to set el.src
Tushar Mathur
@tusharmath
And similarly for play/pause?
basically write a driver ?
Alex
@whitecolor
you are using invisible tag?
Tushar Mathur
@tusharmath
yup
by invisible u mean no controls right?
Alex
@whitecolor
yes
Tushar Mathur
@tusharmath
yes I am
Alex
@whitecolor
Then I would not use tags itself, just create you markup and manage created Audioelement (audio = new Audio()) via driver