How to use the @cycle/history.makeHashHistoryDriver function in @cycle/history

To help you get started, we’ve selected a few @cycle/history 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 shesek / spark-wallet / client / src / server-settings.js View on Github external
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 cyclejs / cyclejs / examples / advanced / routing-view / src / main.js View on Github external
function main(sources) {
  const history$ = sources.DOM.select('nav').events('click')
    .map(e => e.target.dataset.page)
    .compose(dropRepeats())

  const vdom$ = view(sources.history);

  return {
    DOM: vdom$,
    history: history$,
  };
}

run(main, {
  DOM: makeDOMDriver('#app'),
  history: makeHashHistoryDriver()
});
github kylecordes / cycle-example-1 / src / index.ts View on Github external
import { modalify } from 'cyclejs-modal';
import { routerify } from 'cyclic-router';
import onionify from 'cycle-onionify';
import switchPath from 'switch-path';
import xs from 'xstream';

import { App, Sources } from './app';

let main = onionify(App, 'onion');
main = modalify(main);
main = routerify(main, switchPath);

const drivers: any = {
  DOM: makeDOMDriver('#app'),
  HTTP: makeHTTPDriver(),
  history: makeHashHistoryDriver(),
  time: timeDriver
};

export const driverNames: string[] = Object.keys(drivers);
const sinks: (s: Sources) => any = sources => ({
  ...driverNames.map(n => ({ [n]: xs.never() })).reduce(Object.assign, {}),
  ...main(sources)
});

run(sinks, drivers);

@cycle/history

The standard history driver for Cycle.js

MIT
Latest version published 3 years ago

Package Health Score

65 / 100
Full package analysis

Similar packages