Cycle.js Fundamentals

Cycle.js is a framework where your app is described as a simple function taking an event stream as input and outputting an event stream.

Cycle.js builds on RxJS and is a reactive and functional JavaScript framework. What does that mean? In the course, André Staltz, the creator of Cycle.js, will explain it to us.

Watch User Created Playlist (21)

This playlist is user created.

pro-course-rss-logo

PRO RSS Feed

Separate Logic from Effects in Cycle.js

Organize Code in the Main and Effect Functions

Customize Effects from the Main Function

Generalize Effect Handling with Drivers in the run() Function

Read Effects from the DOM with Click Events

Use the Cycle.js run() Function

Make Our Toy DOM Driver More Flexible

Fine-grained Control over the DOM Source in Cycle.js

Use Hyperscript in Cycle.js as an Alternative to Template Languages

Convert our Toy DOM Driver to the Cycle.js DOM Driver

Read Text Input in a Cycle.js Hello World Application

Modify and Track State in Cycle.js

Fetch Data using the Cycle.js HTTP Driver

Manage Multiple Observable Streams in Cycle.js

Organize your Cycle.js Application into the Model-View-Intent Pattern

Create a Generic Cycle.js Component

Use a Cycle.js Component in the main() Function

Use Multiple Independent Instances of a Cycle.js Component

Isolate Component Instances in Cycle.js

Export Values from Components through Sinks in Cycle.js

Overview of Cycle.js

cycle tutorial about Separate Logic from Effects in Cycle.js

Separate Logic from Effects in Cycle.js

3:49 cycle

This lesson is the first in an introduction to Cycle.js. We will see how to build from scratch a toy version of Cycle.js. See how to use RxJS to create simple web apps, and how to separate logic from effects.

cycle tutorial about Organize Code in the Main and Effect Functions

Organize Code in the Main and Effect Functions

2:29 cycle

We need to give structure to our application with logic and effects. This lessons shows how we can organize our code into two parts: main() function for logic, and effects functions for effects.

cycle tutorial about Customize Effects from the Main Function

Customize Effects from the Main Function

1:40 cycle

How can we show one string on the DOM, and a completely different string on Console log? This lesson shows how we can make our main function return multiple Observables, each one targeted at a different type of effect.

cycle tutorial about Generalize Effect Handling with Drivers in the run() Function

Generalize Effect Handling with Drivers in the run() Function

3:16 cycle

The last part of the code we wrote is neither logic nor effects. It is code which ties together logic (main) with effects. We can encapsulate that in a run() function. This lesson shows how we can structure these pieces together, and generalize effect handling with "drivers".

cycle tutorial about Read Effects from the DOM with Click Events

Read Effects from the DOM with Click Events

5:45 cycle

So far we only had effects that write something to the external world, we are not yet reading anything from the external world into our app. This lesson shows how we can change the DOM Driver to return a "DOM Source" representing read effects, such as click events. We will leverage that to create an interactive application.

cycle tutorial about Use the Cycle.js run() Function

Use the Cycle.js run() Function

3:39 cycle

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.

cycle tutorial about Make Our Toy DOM Driver More Flexible

Make Our Toy DOM Driver More Flexible

4:56 cycle

Our previous toy DOM Driver is still primitive. We are only able to send strings as the textContent of the container element. We cannot yet create headers and inputs and all sorts of fancy DOM elements. In this lesson we will see how to send objects that describe what elements should exist, instead of strings as the DOM sink.

cycle tutorial about Fine-grained Control over the DOM Source in Cycle.js

Fine-grained Control over the DOM Source in Cycle.js

2:48 cycle

What if we wanted to change the behavior of our app reset the timer every time the mouse hovers over it? Currently we only support clicks, and they are hard coded in the DOM Driver. This lesson will introduce DOMSource.selectEvents(), a way of making the DOM Source rich and allowing the main() function to determine which read effects it needs.

cycle tutorial about Use Hyperscript in Cycle.js as an Alternative to Template Languages

Use Hyperscript in Cycle.js as an Alternative to Template Languages

2:18 cycle

Usually we use template languages like Handlebars, JSX, and Jade to create. One simple way we can create our own template language is to write a function that returns these objects for us. This lessons shows how we can use these functions as a DSL to create our DOM description objects.

cycle tutorial about Convert our Toy DOM Driver to the Cycle.js DOM Driver

Convert our Toy DOM Driver to the Cycle.js DOM Driver

4:32 cycle

This lessons shows how we are able to easily swap our toy DOM Driver with the actual Cycle.js DOM Driver, a more solid, more flexible, more efficient implementation.

cycle tutorial about Read Text Input in a Cycle.js Hello World Application

Read Text Input in a Cycle.js Hello World Application

5:45 cycle

Now you should have a good idea what Cycle.run does, and what the DOM Driver is. In this lesson, we will not build a toy version of Cycle.js anymore. Instead, we will learn how to use Cycle.js to solve problems. We will start by making a simple Hello world application.

cycle tutorial about Modify and Track State in Cycle.js

Modify and Track State in Cycle.js

5:37 cycle

This lesson shows how we can create a more interactive app: a counter display with buttons to increment and decrement it. We'll see how we can use the xstream fold() operator to remember previous values and combine them to create the next values. This is actually how you keep state in Cycle.js.

cycle tutorial about Fetch Data using the Cycle.js HTTP Driver

Fetch Data using the Cycle.js HTTP Driver

8:10 cycle

Let's see next how to use the HTTP driver to generate requests and capture responses. We will build a small app to fetch a single piece of data from a REST server and display that on the DOM.

cycle tutorial about Manage Multiple Observable Streams in Cycle.js

Manage Multiple Observable Streams in Cycle.js

7:19 cycle

So far we have been writing very small apps in Cycle.js. Let's start growing the size of the apps we build. This time, we will see how to build a simple Body-Mass Index Calculator. We'll see how as our application grows there are three distinct sections: handling read effects, handling write effects, and handling internal state.

cycle tutorial about Organize your Cycle.js Application into the Model-View-Intent Pattern

Organize your Cycle.js Application into the Model-View-Intent Pattern

3:55 cycle

We built the BMI calculator all inside one function: main(). As apps scale, we don't want main() to grow. We need an organized pattern where each function focuses on doing one thing. This lesson shows how we can easily refactor the main() function into three parts: Intent, Model, and View.

cycle tutorial about Create a Generic Cycle.js Component

Create a Generic Cycle.js Component

7:09 cycle

We are starting to get a better architecture for these UI apps. But we still have a problem of repeating code for the sliders, since they share so much in common in looks and functionality. This lessons shows how we can create a generic labeled slider as a main() function receiving properties as sources.

cycle tutorial about Use a Cycle.js Component in the main() Function

Use a Cycle.js Component in the main() Function

2:42 cycle

We have made a Cycle.js app for generic labeled slider which can be configured through props, but how can we reuse it in other Cycle.js apps? This lesson shows how we can embed any Cycle program inside a larger Cycle program in a very simple manner.

cycle tutorial about Use Multiple Independent Instances of a Cycle.js Component

Use Multiple Independent Instances of a Cycle.js Component

5:48 cycle

Once we have a labeled slider component inside the main function, we should be able to create another labeled slider. This lesson teaches how to accomplish that, and make sure those two instances work independently of each other.

cycle tutorial about Isolate Component Instances in Cycle.js

Isolate Component Instances in Cycle.js

4:26 cycle

We added classNames to pre-processing and post-processing steps when calling the LabeledSlider, in order to instances independent of each other. It would be better if we could hide these steps away. This lesson introduces the isolate() helper function to achieve that.

cycle tutorial about Export Values from Components through Sinks in Cycle.js

Export Values from Components through Sinks in Cycle.js

3:18 cycle

Our app is not yet a BMI calculator, because it only has two sliders, but doesn't show the calculated BMI number. In this lesson we will learn how to export any stream from a child component and use it in the parent component, in order to display the BMI calculation on the DOM.

cycle tutorial about Overview of Cycle.js

Overview of Cycle.js

2:52 cycle

This lesson shows what can be learned next as a continuation of this course, and gives a recap on the core concepts: main for pure logic, drivers for side effects, run() to connect main and drivers, sources for read effects, sinks for write effects, and nesting Cycle.js apps to work as components.

HEY, QUICK QUESTION!
Joel's Head
Why are we asking?