How to use @cycle/rxjs-run - 10 common examples

To help you get started, we’ve selected a few @cycle/rxjs-run 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 staltz / rxmarbles / src / app.js View on Github external
const sinks = {
    DOM: appView(sandbox.DOM),
    store: Observable.merge(route$, sandbox.data)
      .scan(merge, {}),
  };

  return sinks;
}

// Note: drivers use xstream 
function dummyDriver(initialValue) {
  return (value$) => value$.remember().startWith(initialValue);
}

run(main, {
  DOM: makeDOMDriver('#app-container'),
  store: dummyDriver({}),
});
github MCS-Lite / mcs-lite / packages / mcs-lite-admin-web / src / store / configureStore.js View on Github external
*/
  if (process.env.NODE_ENV !== 'production') {
    middlewares.push(require('redux-freeze')); // eslint-disable-line global-require
  }

  const store = createStore(
    reducer,
    initialState,
    composeEnhancers(applyMiddleware(...middlewares)),
  );

  /**
   * redux-cycles
   * Remind: MUST create sotre first.
   */
  run(main, {
    ACTION: makeActionDriver(),
    STATE: makeStateDriver(),
    Time: timeDriver,
    HTTP: makeHTTPDriver(),
    STORAGE: storageDriver,
  });

  return store;
};
github shesek / spark-wallet / client / src / server-settings.js View on Github external
, scan$: scanner$
  }
}

const keyMarker = '?access-key='

function parseQR(url) {
  const p = urlutil.parse(url)

  return (p && p.host)
  ? { serverUrl: p.search ? url.substr(0, url.indexOf('?')) : url
    , accessKey: p.search && p.search.startsWith(keyMarker) ? p.search.substr(keyMarker.length) : null }
  : null
}

run(main, {
  DOM: makeDOMDriver('#app')
, IPC: process.env.BUILD_TARGET === 'electron'
  ? require('./driver/electron-ipc')
  : _ => _ => O.of() // noop driver
, storage: storageDriver
, route: makeRouteDriver(makeHashHistoryDriver())
, conf$: makeConfDriver(storageDriver)
, scan$: process.env.BUILD_TARGET === 'cordova'
  ? require('./driver/cordova-qrscanner')
  : require('./driver/instascan')({ mirror: false, backgroundScan: false })
})
github goodmind / cycle-telegram / test / integration / plugins / rxjs.ts View on Github external
})},
    {
      type: Update,
      name: 'not-found',
      component: ({ props }) => {
        t.fail(`wrong command \`${props[0]}\``)
      }}
  ]
  let main = (s: Sources) => ({
    bot: $.from([
      matchStream(s.bot.events('message').filter(entityIs('bot_command')), plugins, s)
        .pluck('bot')
        .mergeAll()
    ])
  })
  let { sources, run } = Cycle(main, { bot: basicDriver })

  run()
  okTake(t, sources, (message) => {
    t.ok(Message.is(Message(message)), 'message satisfies typecheck')
    t.ok(
      /\/(help)(?:@goodmind_test_bot)?(\s+(.+))?/.test(message.reply_to_message.text),
      'reply to message text should match `/help` command pattern')
    t.equal(
      message.text,
      'Cycle Telegram v1.1.1 (https://git.io/vrs3P)',
      'message text should be equal to `Cycle Telegram v1.1.1 (https://git.io/vrs3P)`')
    t.end()
  })
})
github goodmind / cycle-telegram / test / integration / index / rxjs.ts View on Github external
test('should send location with basic driver', t => {
  let basicDriver = makeTelegramDriver(ACCESS_TOKEN, { skipUpdates: true })
  let main = () => ({
    bot: $.from([
      $.of(sendLocation(
        { chat_id: GROUP_ID, latitude: 55.751244, longitude: 37.618423 },
        {}))
    ])
  })
  let { sources, run } = Cycle(main, { bot: basicDriver })

  run()
  okTake(t, sources, (message) => {
    t.ok(Message.is(Message(message)), 'message satisfies typecheck')
    t.ok(message.hasOwnProperty('location'), 'message has property location')
    t.end()
  })
})
github staltz / cycle-onionify / test-with-rxjs.js View on Github external
function main(sources) {
    const List = makeCollection({
      item: child,
      collectSinks: instances => ({
        onion: instances.pickMerge('onion')
      }),
    });
    const obs = List(sources).onion;
    t.is(typeof obs.switchMap, 'function');
    return {
      onion: Observable.never(),
    };
  }

  run(onionify(main), {dummy: () => {}});
});
github axisgroup / RxQ / examples / cycle-basic / src / main.js View on Github external
}));

    appList$.subscribe(s => console.log(`Search Term: \'${s.filter}\' | Filtered Doc List: `, s.list));

    const vdom$ = appList$.map(m => div('.container', [
        input('.input'),
        ul('.application-list', { style: { 'list-style-type': 'none', 'padding': '0px' } },
            m.list.map(n => li('.application-list-item', n.qDocName)))
    ]));

    return {
        DOM: vdom$
    };
}

run(main, {
    DOM: makeDOMDriver('#app-container'),
});
github axisgroup / RxQ / examples / cycle-combined / src / main.js View on Github external
appList$.subscribe(s => console.log(`Search Term: \'${s.filter}\' | Filtered Doc List: `, s.list));

    const vdom$ = appList$.map(m => div('.container', [
        input('.input', { attr: { 'placeholder': 'Filter' } }),
        ul('.application-list', { style: { 'list-style-type': 'none', 'padding': '0px' } },
            m.list.map(n => li('.application-list-item', [
                div(n.qDocName + ` (${n.server})`)
            ])))
    ]));

    return {
        DOM: vdom$
    };
}

run(main, {
    DOM: makeDOMDriver('#app-container'),
});
github brucou / cycle-state-machine-demo / src / index.js View on Github external
.then(() => {
    run(App, drivers);
  })
  .catch(function (err) {
github cyclejs-community / cyclejs-sortable / examples / horizontal / src / index.ts View on Github external
ul([
            li(['Option 1']),
            li(['Option 2']),
            li(['Option 3']),
            li(['Option 4']),
            li(['Option 5']),
            li(['Option 6'])
        ])
    );

    return {
        DOM: vdom$
    };
}

run(main, {
    DOM: makeDOMDriver('#app'),
    drag: userSelectDriver
});

@cycle/rxjs-run

The Cycle run() function meant to be used with RxJS v5

MIT
Latest version published 4 years ago

Package Health Score

65 / 100
Full package analysis

Popular @cycle/rxjs-run functions