4.0.2 • Published 6 years ago

cyclejs-utils v4.0.2

Weekly downloads
85
License
MIT
Repository
-
Last release
6 years ago

cyclejs-utils

A few helper functions for dealing with sinks

Links

git repository: https://github.com/cyclejs-community/cyclejs-util

npm package: https://www.npmjs.com/package/cyclejs-utils

typedoc documentation: https://cyclejs-community.github.io/cyclejs-utils/

Usage

The most useful functions are mergeSinks and extractSinks.

import { ChildComponent } from 'XXX'
import { mergeSinks, extractSinks } from 'cyclejs-utils'

const drivers = { /* ... */ };
const driverNames = Object.keys(drivers);

function main(sources)
{
    const children$: Stream<Sinks[]> = sources.state
        .map(s => s.childState.map(c => ChildComponent(sources)));

    // Merge all children Sinks automaticly, but combine DOM and display in div
    const child$: Stream<Sinks> = children$.map(arr => mergeSinks(arr, {
        DOM: arr => xs.combine(...arr).map(div)
    }));

    return extractSinks(child$, driverNames),
}
4.0.2

6 years ago

4.0.1

6 years ago

4.0.0

6 years ago

3.2.0

6 years ago

3.1.0

6 years ago

3.0.4

7 years ago

3.0.3

7 years ago

3.0.2

7 years ago

3.0.1

7 years ago

3.0.0

7 years ago

2.0.0

7 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago