How to use the rx.Observable.empty function in rx

To help you get started, we’ve selected a few rx 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 ivan-kleshnin / cyclejs-examples / 2.1-routing / src / app.js View on Github external
.scan((prevPage, navi) => {
      // Unsubscribe previous page (if there was)
      if (prevPage.subscriptions) {
        prevPage.subscriptions.forEach((s) => s.dispose())
      }

      // Make disposable sinks
      let sinkProxies = {
        DOM: new ReplaySubject(1),
        log: new ReplaySubject(1),
      }

      // Run page
      let sinks = merge({
        log: $.empty(),      // affects log
        DOM: $.empty(),      // affects DOM
      }, navi.page(src))

      // Subscribe current page
      let subscriptions = [
        sinks.DOM.subscribe(sinkProxies.DOM.asObserver()),
        sinks.log.subscribe(sinkProxies.log.asObserver()),
      ]

      return {navi, sinks: sinkProxies, subscriptions}
    }, {})
    .pluck("sinks")
github ivan-kleshnin / cyclejs-examples / 3.0-crud / src / app.js View on Github external
if (prevPage && prevPage.subscriptions) {
        prevPage.subscriptions.forEach((s) => s.dispose())
      }

      // Make disposable sinks
      let sinkProxies = {
        redirect: new ReplaySubject(1),
        update: new ReplaySubject(1),
        DOM: new ReplaySubject(1),
        log: new ReplaySubject(1),
        state2: new ReplaySubject(1),
      }

      // Run page
      let sinks = merge({
        redirect: $.empty(), // affects navi
        update: $.empty(),   // affects state
        log: $.empty(),      // affects log
        DOM: $.empty(),      // affects DOM
        state2: $.empty(),   // nested state loop
      }, navi.page(merge(src, {state2: sinkProxies.state2})))

      // Subscribe current page
      let subscriptions = [
        sinks.redirect.subscribe(sinkProxies.redirect.asObserver()),
        sinks.update.subscribe(sinkProxies.update.asObserver()),
        sinks.DOM.subscribe(sinkProxies.DOM.asObserver()),
        sinks.log.subscribe(sinkProxies.log.asObserver()),
        sinks.state2.subscribe(sinkProxies.state2.asObserver()),
      ]

      return {navi, sinks: sinkProxies, subscriptions}
github ivan-kleshnin / cyclejs-examples / 3.0-crud / src / app.js View on Github external
prevPage.subscriptions.forEach((s) => s.dispose())
      }

      // Make disposable sinks
      let sinkProxies = {
        redirect: new ReplaySubject(1),
        update: new ReplaySubject(1),
        DOM: new ReplaySubject(1),
        log: new ReplaySubject(1),
        state2: new ReplaySubject(1),
      }

      // Run page
      let sinks = merge({
        redirect: $.empty(), // affects navi
        update: $.empty(),   // affects state
        log: $.empty(),      // affects log
        DOM: $.empty(),      // affects DOM
        state2: $.empty(),   // nested state loop
      }, navi.page(merge(src, {state2: sinkProxies.state2})))

      // Subscribe current page
      let subscriptions = [
        sinks.redirect.subscribe(sinkProxies.redirect.asObserver()),
        sinks.update.subscribe(sinkProxies.update.asObserver()),
        sinks.DOM.subscribe(sinkProxies.DOM.asObserver()),
        sinks.log.subscribe(sinkProxies.log.asObserver()),
        sinks.state2.subscribe(sinkProxies.state2.asObserver()),
      ]

      return {navi, sinks: sinkProxies, subscriptions}
    }, {})
github ivan-kleshnin / cyclejs-examples / 3.0-crud / src / app.js View on Github external
}

      // Make disposable sinks
      let sinkProxies = {
        redirect: new ReplaySubject(1),
        update: new ReplaySubject(1),
        DOM: new ReplaySubject(1),
        log: new ReplaySubject(1),
        state2: new ReplaySubject(1),
      }

      // Run page
      let sinks = merge({
        redirect: $.empty(), // affects navi
        update: $.empty(),   // affects state
        log: $.empty(),      // affects log
        DOM: $.empty(),      // affects DOM
        state2: $.empty(),   // nested state loop
      }, navi.page(merge(src, {state2: sinkProxies.state2})))

      // Subscribe current page
      let subscriptions = [
        sinks.redirect.subscribe(sinkProxies.redirect.asObserver()),
        sinks.update.subscribe(sinkProxies.update.asObserver()),
        sinks.DOM.subscribe(sinkProxies.DOM.asObserver()),
        sinks.log.subscribe(sinkProxies.log.asObserver()),
        sinks.state2.subscribe(sinkProxies.state2.asObserver()),
      ]

      return {navi, sinks: sinkProxies, subscriptions}
    }, {})
    ::history(2)
github ivan-kleshnin / cyclejs-examples / 3.0-crud.alt / src / app.js View on Github external
let sinkProxies = {
        update: new ReplaySubject(1),
        update2: new ReplaySubject(1),
        DOM: new ReplaySubject(1),
        log: new ReplaySubject(1),
      }

      // Run page
      let sources = {
        update2: sinkProxies.update2.delay(1),
        navi: navi.delay(1),
        state: state.delay(1),
        DOM: src.DOM,
      }
      let sinks = merge({
        update: $.empty(),
        update2: $.empty(),
        DOM: $.empty(),
        log: $.empty(),
      }, _navi.page(sources))

      // Subscribe current page
      let subscriptions = [
        sinks.update.subscribe(sinkProxies.update.asObserver()),
        sinks.update2.subscribe(sinkProxies.update2.asObserver()),
        sinks.DOM.subscribe(sinkProxies.DOM.asObserver()),
        sinks.log.subscribe(sinkProxies.log.asObserver()),
      ]

      return {navi: _navi, sinks: sinkProxies, subscriptions}
    }, {})
    ::history(2)
github tierratelematics / prettygoat / test / fixtures / cassandra / MockCassandraClient.ts View on Github external
execute(query: IQuery): Rx.Observable {
        return Observable.empty();
    }
github tierratelematics / prettygoat / test / ProjectionEngineSpec.ts View on Github external
            snapshotRepository.setup(s => s.saveSnapshot("test", It.isValue(new Snapshot(66, new Date(5000))))).returns(a => Observable.empty());
            subject.run();
github laszlokorte / tams-tools / app / components / graphics / intent / gestures.js View on Github external
const pinchMove$ = globalEvents
    .events('touchmove');

  const touchAction$ = touchZoom({
    pinchStart$, pinchMove$, pinchEnd$,
    owner$, positionFn,
  });

  const wheelAction$ = wheelZoom({wheel$, owner$, positionFn});

  return {
    action$: O.merge([
      touchAction$,
      wheelAction$,
    ]).share(),
    stopPropagation: O.empty(),
    preventDefault: wheel$,
  };
};
github laszlokorte / tams-tools / app / components / led / panels / save / index.js View on Github external
export default ({
    DOM, globalEvents, visible$,
    table$ = O.empty(),
    formula$ = O.empty(),
}) => {
  const {isolateSource, isolateSink} = DOM;

  const actions = intent({DOM: isolateSource(DOM, 'modalBody')});
  const state$ = model(table$, formula$, actions);
  const modal = isolate(ModalBox, 'modal')({
    DOM,
    globalEvents,
    props$: visible$.map((visible) => ({visible})),
    content$: isolateSink(view(state$), 'modalBody'),
  });

  return {
    DOM: modal.DOM.map(wrapInDiv),
    selectAll: actions.selectAll$,
  };
github TylorS / cycle-snabbdom / src / mockDOMSource.js View on Github external
events (eventType) {
    const mockConfig = this._mockConfig
    const keys = Object.keys(mockConfig)
    const keysLen = keys.length
    for (let i = 0; i < keysLen; i++) {
      const key = keys[i]
      if (key === eventType) {
        return mockConfig[key]
      }
    }
    return Observable.empty()
  }