How to use the xstream.never function in xstream

To help you get started, we’ve selected a few xstream 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 sarimarton / powercycle / src / util / withLocalState.js View on Github external
sources[localChannel].stream.startWith(undefined)
      )
      .map(([g, l]) => merger.merge(g, l))
      .remember()

    const sinks = cmp({
      ...omit([localChannel])(sources),
      [stateChannel]: new StateSource(
        state$.drop(2),
        'withLocalState'
      )
    })

    // Convert the emitted reducers back to state values and run
    // it through extract
    const updated$ = !sinks[stateChannel] ? xs.never() :
      sinks[stateChannel]
        .compose(sampleCombine(state$))
        .map(([reducer, state]) => merger.extract(reducer(state)))

    // Convert the extracted state values back to reducers for the separate
    // channels
    const global$ = updated$.map(extractedState => prevState => {
      return { ...prevState, ...extractedState.global }
    })

    const local$ = updated$.map(extractedState => prevState => {
      return { ...prevState, ...extractedState.local }
    })

    return {
      ...sinks,
github staltz / cycle-onionify / src / pickMerge.ts View on Github external
_n(inst: InternalInstances): void {
    this.inst = inst;
    const arrSinks = inst.arr;
    const ils = this.ils;
    const out = this.out;
    const sel = this.sel;
    const n = arrSinks.length;
    // add
    for (let i = 0; i < n; ++i) {
      const sinks = arrSinks[i];
      const key = sinks._key as any as string;
      const sink: Stream = xs.fromObservable(sinks[sel] || xs.never());
      if (!ils.has(key)) {
        ils.set(key, new PickMergeListener(out, this, sink));
        sink._add(ils.get(key) as PickMergeListener);
      }
    }
    // remove
    ils.forEach((il, key) => {
      if (!inst.dict.has(key) || !inst.dict.get(key)) {
        il.ins._remove(il);
        il.ins = null as any;
        il.out = null as any;
        ils.delete(key);
      }
    });
  }
github cyclejs-community / cyclejs-modal / src / modalify.ts View on Github external
const xsComponentSinks: Sinks = Object.keys(
                            componentSinks
                        )
                            .map(k => ({
                                [k]: xs.fromObservable(componentSinks[k])
                            }))
                            .reduce(
                                (prev, curr) => Object.assign(prev, curr),
                                {}
                            );
                        return [
                            ...acc,
                            {
                                ...xsComponentSinks,
                                modal: xs.merge(
                                    xsComponentSinks.modal || xs.never(),
                                    overlayClose$
                                )
                            }
                        ];
                    }
                    return acc;
                }, []);
github staltz / dat-installer / src / frontend / screens / details / index.ts View on Github external
h(Text, { style: styles.installText }, "Install"),
          ]),
        ],
      ),
      h(ScrollView, { style: styles.readmeContainer }, [
        h(Markdown, { styles: mdStyles, rules }, state.app.readme),
        h(View, { style: styles.readmeFooter }),
      ]),
    ]),
  }));

  return {
    screen: vdom$,
    navCommand: xs.never(),
    onion: xs.never(),
    http: xs.never(),
    installApk: installApk$,
  };
}
github staltz / manyverse / src / frontend / screens / secret-input / index.ts View on Github external
state: topBarLens,
  })(sources);

  const state$ = sources.state.stream;
  const actions = intent(sources.navigation, sources.screen, topBarSinks.back);
  const confirmation$ = dialog(actions, state$, sources.ssb, sources.dialog);
  const dismissKeyboard$ = actions.goBack$.mapTo('dismiss' as 'dismiss');
  const vdom$ = view(state$, topBarSinks.screen);
  const command$ = navigation(state$, actions, confirmation$);
  const reducer$ = model(sources.props, actions);

  return {
    keyboard: dismissKeyboard$,
    screen: vdom$,
    navigation: command$,
    toast: xs.never(),
    state: reducer$,
  };
}
github staltz / dat-installer / src / frontend / screens / details / index.ts View on Github external
h(View, { style: styles.installContainer }, [
            h(Text, { style: styles.installText }, "Install"),
          ]),
        ],
      ),
      h(ScrollView, { style: styles.readmeContainer }, [
        h(Markdown, { styles: mdStyles, rules }, state.app.readme),
        h(View, { style: styles.readmeFooter }),
      ]),
    ]),
  }));

  return {
    screen: vdom$,
    navCommand: xs.never(),
    onion: xs.never(),
    http: xs.never(),
    installApk: installApk$,
  };
}
github kylecordes / cycle-example-1 / src / index.ts View on Github external
  ...driverNames.map(n => ({ [n]: xs.never() })).reduce(Object.assign, {}),
  ...main(sources)
github cyclejs / cyclejs / dom / src / makeDOMDriver.ts View on Github external
function dropCompletion(input: Stream): Stream {
  return xs.merge(input, xs.never());
}
github staltz / manyverse / src / frontend / screens / central / connections-tab / intent.ts View on Github external
.map(isTabVisible =>
        isTabVisible
          ? concat(xs.of(0), xs.periodic(2000).take(2), xs.periodic(6000))
          : xs.never(),
      )
github staltz / manyverse / src / frontend / components / tutorial-presentation.ts View on Github external
export default function tutorialPresentation(
  sel: string | symbol,
  props: Props | null,
  children: Array,
) {
  return h(View, {style: styles.container}, [
    h(
      Swiper,
      {
        sel,
        showsButtons: false,
        horizontal: true,
        loop: false,
        scrollBy$: props?.scrollBy$ ?? xs.never(),
        activeDotColor: Palette.colors.white,
        automaticallyAdjustContentInsets: true,
      },
      children,
    ),
  ]);
}