⚠️ This lesson is retired and might contain outdated information.

Create RxJS Streams in the Vue.js Subscriptions Function

John Lindquist
InstructorJohn Lindquist
Share this video with your friends

Social Share Links

Send Tweet
Published 7 years ago
Updated 9 months ago

While it's possible to use an Object to configure your streams, using a Function gives you much more flexibility to configure streams. This lesson shows how to use the functions to configure and return multiple streams based on the same source.

Instructor: [00:00] rather than using a subscription's object, it's more common to use a subscription's function. The function returns an object with those streams on it. If I create another interval here and say this is observable interval of one second, then I can create a times two, which is interval and mapped to that value times two.

[00:28] We'll duplicate this line and create a times three, which is the same but times three. Then, I can return an object with both of these on there, so times two and times three and render them both out. Instead of message, we'll render out times two and times three.

[00:50] Hit Save here, and you'll see these will update by twos and threes because we have a function returning an object with multiple streams on it...