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

Generalizing run() function for more types of sources

Generalizing run() function for more types of sources

4:23
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
HEY, QUICK QUESTION!
Joel's Head
Why are we asking?