Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Nov 09 23:05
    CarlLeth commented #310
  • Nov 09 23:04
    CarlLeth commented #310
  • Nov 09 23:03
    CarlLeth commented #310
  • Nov 09 18:52
    matthewjamesadam commented #310
  • Nov 09 08:45
    staltz commented #310
  • Nov 09 08:45
    staltz commented #310
  • Nov 09 08:44
    staltz commented #310
  • Nov 09 04:53
    matthewjamesadam commented #310
  • Jul 14 15:56
    Avaq edited #337
  • Jul 14 15:49
    Avaq synchronize #337
  • Jul 14 15:39
    Avaq edited #337
  • Jul 14 15:38
    Avaq edited #337
  • Jul 14 15:38
    Avaq edited #337
  • Jul 14 15:38
    Avaq opened #337
  • Jun 22 05:52
    dependabot[bot] labeled #336
  • Jun 22 05:52
    dependabot[bot] opened #336
  • Jun 22 05:52

    dependabot[bot] on npm_and_yarn

    chore(deps): bump shell-quote f… (compare)

  • May 02 16:35
    PEZO19 commented #46
  • May 02 16:34
    PEZO19 commented #46
  • May 02 16:34
    PEZO19 commented #46
André Staltz
@staltz
I'm busy right now, can't fix that issue with the site
Steve Lee
@SteveALee
NP - as long as you aware - shall I raise issue for site? Would do PR for both but also busy.
Marius
@MariusKazlauskas
Hey ppl, will the talks be published online? And if so, any clue when?
André Staltz
@staltz
Yes they will. I was talking with the people at Futurice and they gave me the impression of a few days ahead. maybe they are doing final touches
Marius
@MariusKazlauskas
cool stuff :) I'll do an overview to my colleagues of the conf, want to make the timing right to provide available resources also
Aron Nyborg Allen
@aronallen
@MariusKazlauskas most of the videos are up now
only missing the ones from the bar.
Marius
@MariusKazlauskas
noticed ;)
Вячеслав Истомин
@shofel

Hey!
I'm trying to make a page with 3 checkboxes and a button. The button should be enabled when all the checkboxes checked and disabled otherwise.

The code below tries keeping this simple, but fails due to Uncaught RangeError: Maximum call stack size exceeded.
Could anyone suggest a fix for this?

let main = (sources) => {
  let checkboxes$ = sources.DOM.select('.my-checkbox')
  let elements$ = checkboxes$.elements()
  let change$ = checkboxes$.events('change')

  let DOMSink = change$.map(() =>
    elements$
      .map(elems => elems.map(elem => elem.checked))
  )
  .flatten()
  .startWith(false)
  .map(view)

  function view () {
    return div([
      input('.my-checkbox', {attrs: {type: 'checkbox'}}),
      input('.my-checkbox', {attrs: {type: 'checkbox'}}),
      input('.my-checkbox', {attrs: {type: 'checkbox'}})
    ])
  }

  return {
    DOM: DOMSink
  }
}
Churchill Lee
@FeliciousX

hi @shofel , just letting u know there's a cyclejs gitter channel :3 since this is more cyclejs related than xstream

but anyways

checkboxes$.elements() would emit everytime your element changes.. and you're using it to render the checkbox again.. and so it becomes a never ending loop

also your code does not utilize a button as of now
Вячеслав Истомин
@shofel
@FeliciousX, thanks for the reply! All you have written does make sense :D Let me repost this question to the cyclejs gitter channel.
fiatjaf
@fiatjaf
I don't understand the difference between addListener and subscribe
what is it?
if a stream has only listeners and no subscribers it will not run, is that it?
fiatjaf
@fiatjaf

a different question:
if I do something like

let count$ = xs.periodic(1000)
let count2$ = count$.map(c => c * 2)
let count3$ = count$.map(c => c * 3)
let countAndCount2AndCount3$ = count$.compose(sampleCombine(count2$, count3$))

can I be sure countAndCount2AndCount3$ will be -[1,2,3]---[2,4,6]---[3,6,9]-?
or does it depend on race conditions and maybe it will be -[1,2,3]---[2,2,3]---[3,4,9]-?

André Staltz
@staltz
@fiatjaf addListener and subscribe are basically the same, but subscribe returns a subscription
basically we we addListener, but subscribe is there just to have interop with ES Observable
the second question: I wouldn't model the problem like that because it's a diamond shaped situation and you might hit glitches
read my blog post about glitches in rxjs
fiatjaf
@fiatjaf
oh, those are the famous glitches! I'm reading it.
André Staltz
@staltz
yep
in short, we don't try to guarantee those conditions you mentioned. maybe it will work like you expected, but glitch avoidance is actually super expensive on performance to guarantee always
fiatjaf
@fiatjaf
so the recommendation is to never do diamonds?
just map the values directly instead of creating different streams and combining them together later?
André Staltz
@staltz
yes
diamonds are overrated :D
fiatjaf
@fiatjaf
:P
Steve Lee
@SteveALee
'Diamonds are forever' - sometimes! :(
fiatjaf
@fiatjaf
just found a diamond: http://i.imgur.com/YKiSZKM.png
André Staltz
@staltz
yep and Elm nowadays doesn't have signals : )
Samuel DeSota
@mrapogee

@staltz Has anybody created this? Proxies with imitate() kinda suck, I was thinking they could be replaced with a lazy stream function, this:

const proxy$ = xs.create()
const child = Child({value: proxy$})
proxy$.imitate(child.value)

becomes:

const childValue$ = lazy(() => child.value)
const child = Child({value: childValue$})
They lazy() function returns a xstream that doesn't call the () => child.value until it is subscribed to.
Churchill Lee
@FeliciousX
why do they suck? @mrapogee
André Staltz
@staltz
@mrapogee that's smart, and would work. imitate is just a bit more general because the streams don't need to be all in the same variable scope/closure
Michal Vanko
@michalvankodev
How can I describe a type of Stream that will never emit any value, but it can emit error ?
André Staltz
@staltz
Stream<any>
errors are untyped
throughout the entire JavaScript and TypeScript, actually (note that try/catch is never typed)
Michal Vanko
@michalvankodev
Thanks man :) I've noticed that xs.never() -> Stream<any>
André Staltz
@staltz
:+1:
jfcha
@jfcha
Is there a good way to access the stored value in MemoryStream? I'm guessing I could use a listener to update an environment variable, but that seems pretty messy.
adz5a
@adz5a
as the memory stream will emit its last emitted value, you could stream.take(1).addListener to retrieve the stored value
jfcha
@jfcha
I was hoping to avoid going through a listener, but good to know that'll work. Thanks. I suppose getting values outside of the stream isn't really ideal behavior so having to pay a tax on it makes some sense.
adz5a
@adz5a
i don't think there is another way to "unwrap" values from a stream apart from a listener, what is your use case, maybe i can help :)
jfcha
@jfcha
It's a bit complicated and I have a work around. I was just hoping for a lazy answer :) . Thanks for the offer though! If I come up with a succinct case I'll ask again.
adz5a
@adz5a
hello, I have a case
a problem, that i don't quite understand, I made gist of it