The ability to reply to discussions is limited to PRO members. Want to join in the discussion? Click here to subscribe now.

Use the Cycle.js run() function

Use the Cycle.js run() function

3:39
Our application was able to produce write effects, through sinks, and was able to receive read effects, through the DOM sources. However, the main function only gets the DOMSource as input. This lessons shows how we can generalize main to receive an object of sources, containing all kinds of read effects that we can use.
Watch this lesson now
Avatar
egghead.io

Our application was able to produce write effects, through sinks, and was able to receive read effects, through the DOM sources. However, the main function only gets the DOMSource as input. This lessons shows how we can generalize main to receive an object of sources, containing all kinds of read effects that we can use.

Avatar
Kevin

Before we included Cycle core to invoke run as a library, shouldn't we have checked if source wasn't undefined for the proxySource associated with Log using if ( source ) or if ( !!source ) or if( source && ( 'subscribe' in source ) )?

In reply to egghead.io
Avatar
Andre

Kevin, that is correct! Official Cycle Core library has these checks.

In reply to Kevin
Avatar
Kevin

Right, understood (thanks for ignoring my mistake of not mentioning instanceof Observable instead of what I wrote before).

In reply to Andre
Avatar
wil

Up to this lesson I had been working with rxjs5, but I don't know the cycle.js ecosystem well enough to discover the right import to factor in Cycle.run.

I tried https://cdnjs.cloudflare.com/ajax/libs/cyclejs-core/7.0.0/cycle.js, but that did not work.

Can you correct my reference? I wish to continue the lessons with rxjs5.

Avatar
Andre

Hi Will. In this course we've been using RxJS version 4. In the JSBin you can see from the HTML tab which JS resources we are using, for instance https://cdnjs.cloudflare.com/ajax/libs/cyclejs-core/6.0.3/cycle.js. We should update the course material to reflect the latest versions.

In reply to wil
HEY, QUICK QUESTION!
Joel's Head
Why are we asking?