How to use the mobx-utils.fromStream function in mobx-utils

To help you get started, we’ve selected a few mobx-utils 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 tpucci / react-nonav / src / createCanal.tsx View on Github external
isAuthorized:
              /**
               * @TODO 19-06-01 Check if Authorization type can be indexed with StopName type.
               * See https://github.com/Microsoft/TypeScript/issues/2491.
               */
              // @ts-ignore
              !!authorizations[name] && (last(acc) ? last(acc).isAuthorized : true),
            isFullScreen,
            name,
          });
          return acc;
        }, [])
      )
    );

    stack = fromStream(
      this.progress$.pipe(
        map(progressStopsList => progressStopsList.filter(stop => !stop.isFullScreen))
      ),
      []
    );

    fullScreenStackProperties$ = this.progress$.pipe(
      map(progressStopsList => ({
        canalId: this.canalId,
        fullScreenStack: progressStopsList.filter(stop => stop.isFullScreen),
      })),
      distinctUntilChanged(
        ({ fullScreenStack: previousFullScreenStack }, { fullScreenStack: nextFullScreenStack }) =>
          previousFullScreenStack.filter(stop => stop.isAuthorized).length ===
          nextFullScreenStack.filter(stop => stop.isAuthorized).length
      )
github phiresky / backchannel-prediction / evaluate / plot / util.ts View on Github external
export function throttleGet(time: number, getter: () => T): T {
    if(tcache.has(getter)) {
        return tcache.get(getter)!.current;
    }
    const ob = Rx.Observable.from(mu.toStream(getter));
    const ob2 = ob.debounceTime(time); //.merge(ob.delay(time).sampleTime(time));
    const v = mu.fromStream(ob2, mobx.untracked(getter));
    tcache.set(getter, v);
    return v.current;
}
github tpucci / react-nonav / src / FullScreenPortal.tsx View on Github external
import React, { Component as ReactComponent, Fragment } from 'react';
import { View, StyleSheet } from 'react-native';
import { Observer } from 'mobx-react';
import { fromStream } from 'mobx-utils';
import { Navigation } from './Navigation';

export class FullScreenPortal extends ReactComponent {
  fullScreenStack = fromStream(Navigation.instance.fullScreenDelegate.fullSceenStack$);

  render() {
    return (