How to use callbag-basics - 10 common examples

To help you get started, we’ve selected a few callbag-basics examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github fanduel-oss / refract / base / __tests__ / react / callbag / aperture.ts View on Github external
> = component =>
    pipe(
        component.observe(),
        map(({ prop }) => ({
            newProp: `${prop} world`
        })),
        map(asProps)
    )
github qiscus / qiscus-sdk-web-core / src / utils / callbag.ts View on Github external
export const toCallback = <a>(callback: Callback</a><a>) =&gt; (source: Source</a><a>) =&gt; {
  if (callback == null) callback = (_, error) =&gt; error &amp;&amp; console.log(error)
  return pipe(
    source,
    catchError((error: Error) =&gt; callback(null, error)),
    observe((value: A) =&gt; callback(value, null))
  )
}
export const toCallbackOrPromise = </a><a>(cb?: Callback</a><a>) =&gt; (source: Source</a><a>) =&gt; {</a>
github tryanzu / frontend / src / board / containers / chat.js View on Github external
function counters$(realtime, next) {
    return pipe(
        fromObs(channelToObs(realtime, 'chat:counters')),
        map(msg => msg.params),
        map(counters => ({
            ...counters,
            isOnline: new window.Map(counters.peers || []),
        })),
        subscribe({ next })
    );
}
github langhuihui / rx4rx / perf / filter-map-reduce.js View on Github external
.add('cb-basics', function (deferred) {
        runners.runCallbag(deferred,
            callbag.pipe(
                fromArray(a),
                callbag.filter(even),
                callbag.map(add1),
                callbag.scan(sum, 0)
            )
        );
    }, options)
    .add('xstream', function (deferred) {
github langhuihui / rx4rx / perf / filter-map-fusion.js View on Github external
.add('cb-basics', function (deferred) {
        runners.runCallbag(deferred,
            callbag.pipe(
                fromArray(a),
                callbag.map(add1),
                callbag.filter(odd),
                callbag.map(add1),
                callbag.map(add1),
                callbag.filter(even),
                callbag.scan(sum, 0)
            )
        );
    }, options)
    .add('xstream', function (deferred) {
github langhuihui / rx4rx / perf / combine.js View on Github external
.add('cb-basics', function (deferred) {
        runners.runCallbag(deferred,
            callbag.pipe(
                callbag.combine(cbag1, cbag2, cbag3),
                callbag.map(add3Arr),
                callbag.filter(even)
            )
        );
    }, options)
    .add('xstream', function (deferred) {
github htmlburger / carbon-fields / packages / metaboxes / monitors / conditional-display / aperture / post-format.js View on Github external
addFilter( 'carbon-fields.conditional-display-post-format.classic', 'carbon-fields/metaboxes', () => {
	const node = document.querySelector( 'div#post-formats-select' );

	if ( ! node ) {
		return of( INITIAL_STATE );
	}

	return pipe(
		fromDelegatedEvent( node, 'input.post-format', 'change' ),
		map( ( { target } ) => getPostFormatFromRadioInput( target ) ),
		startWith( getPostFormatFromRadioInput( node.querySelector( 'input.post-format:checked' ) ) )
	);
} );
github tryanzu / frontend / src / board / containers / chat.js View on Github external
function counters$(realtime, next) {
    return pipe(
        fromObs(channelToObs(realtime, 'chat:counters')),
        map(msg => msg.params),
        map(counters => ({
            ...counters,
            isOnline: new window.Map(counters.peers || []),
        })),
        subscribe({ next })
    );
}
github fanduel-oss / refract / examples / debounced-fetch / callbag / src / index.js View on Github external
const aperture = ({ observe }) =>
    pipe(
        observe('username'),
        filter(Boolean),
        debounce(1000),
        map(username =>
            fromPromise(
                fetch(`https://api.github.com/users/${username}`).then(res =>
                    res.json()
                )
            )
        ),
        flatten,
        map(payload => ({ type: 'USER_DATA_RECEIVE', payload }))
    )
github langhuihui / rx4rx / perf / combine.js View on Github external
.add('cb-basics', function (deferred) {
        runners.runCallbag(deferred,
            callbag.pipe(
                callbag.combine(cbag1, cbag2, cbag3),
                callbag.map(add3Arr),
                callbag.filter(even)
            )
        );
    }, options)
    .add('xstream', function (deferred) {

callbag-basics

Basic callbag factories and operators to get started with

MIT
Latest version published 3 years ago

Package Health Score

45 / 100
Full package analysis

Popular callbag-basics functions