How to use the xstream/extra/concat 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 cyclejs / cyclejs / dom / src / makeDOMDriver.ts View on Github external
.map(el => {
              mutationObserver.observe(el, {
                childList: true,
                attributes: true,
                characterData: true,
                subtree: true,
                attributeOldValue: true,
                characterDataOldValue: true,
              });
              return el;
            })
            .compose(dropCompletion) // don't complete this stream
      )
      .flatten();

    const rootElement$ = concat(domReady$, mutationConfirmed$)
      .endWhen(sanitation$)
      .compose(sampleCombine(elementAfterPatch$))
      .map(arr => arr[1])
      .remember();

    // Start the snabbdom patching, over time
    rootElement$.addListener({error: reportSnabbdomError});

    const delegator = new EventDelegator(rootElement$, isolateModule);

    return new MainDOMSource(
      rootElement$,
      sanitation$,
      [],
      isolateModule,
      delegator,
github staltz / matrixmultiplication.xyz / src / Calculator / view.ts View on Github external
.map(state => {
      const ease = tween.power2.easeInOut;
      const xMove = 63.5; // px
      const padding = 8;
      const yLift = padding +
        state.measurements.matrixAHeight * 0.5 +
        state.measurements.matrixBHeight * 0.5;
      return concat(
        tween({ from: 0, to: yLift, duration: styles.step1Duration1, ease })
          .map(y => `
            translateX(0%)
            translateY(-${y}px)
            rotateZ(0deg)
          `),
        tween({ from: 0, to: 1, duration: styles.step1Duration2, ease })
          .map(x => `
            translateX(-${x * xMove}px)
            translateY(-${yLift}px)
            rotateZ(-${Math.pow(x, 2.3) * 90}deg)
          `),
      );
    })
    .flatten();
github cyclejs / cycle-time-travel / src / time-travel.ts View on Github external
const doTheThing$ = pauseByBarMousedown$.map(() => {
        return concat(
          concat(xs.of((playing: boolean): boolean => false), xs.never()).endWhen(mouseUp$),
          xs.of((playing: boolean): boolean => true)
        )
      }
    ).flatten();
github cyclejs / cyclejs / examples / intermediate / animation / src / main.js View on Github external
  const coords$ = start$.map(() => concat(
    xs.of({ left: 0, top: 0 }), leftToRight$, topToBottom$, circularReturn$
  )).flatten().startWith({ left: 0, top: 0 });
github staltz / matrixmultiplication.xyz / src / Calculator / view / tweens.ts View on Github external
.map(state => {
      const ease = tween.power2.easeInOut;
      const yLift = padding +
        state.measurements.matrixAHeight * 0.5 +
        state.measurements.matrixBHeight * 0.5;
      return concat(
        tween({ from: 0, to: yLift, duration: styles.step1Duration1, ease })
          .map(y => `
            translateX(0%)
            translateY(${-y}px)
            rotateZ(0deg)
          `),
        tween({ from: 0, to: 1, duration: styles.step1Duration2, ease })
          .map(t => `
            translateX(${-t * xMove}px)
            translateY(${-yLift}px)
            rotateZ(${-Math.pow(t, 2.3) * 90}deg)
          `),
      );
    })
    .flatten();
github domagojk / cycle-grid-driver / src / grid.js View on Github external
const mainStream = () => {
    return concat(xs.fromArray(mainStreamHistory), main$$);
  }