Skip to content

Split

Splitting allows one stream to be split into two or more independent streams. Since streams are one-way, anything happening in one of these child streams does not affect the parent nor its siblings.

Rx.split takes an input stream and a number denoting how many streams to break it into:

const split = Rx.split(source, { quantity: 5 });
// 'split' will be an array of 5 reactives

You can also produce ‘labelled’ split streams with Rx.splitLabelled . In this case, rather than giving a quantity, we give a list of labels. Make sure these are valid property names for objects.

const { a, b, c } = Rx.split(source, `a`, `b`, `c`);
// a, b & c will all be reactives