How to use the @cycle/run.run function in @cycle/run

To help you get started, we’ve selected a few @cycle/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 usm4n / cycle-hn / src / index.ts View on Github external
History: captureClicks(makeHistoryDriver())
};
/// #else
driverFn = () => ({
    DOM: restartable(makeDOMDriver('#app'), {
        pauseSinksWhileReplaying: false
    }),
    HTTP: restartable(makeHTTPDriver()),
    Time: timeDriver,
    History: captureClicks(makeHistoryDriver())
});
/// #endif
export const driverNames: string[] = Object.keys(drivers || driverFn());

/// #if PRODUCTION
run(main as any, drivers);
// register service worker
if ('serviceWorker' in navigator) {
    navigator.serviceWorker
        .register('/service-worker.js')
        .then(registration => console.log('SW registration successful with scope: ', registration.scope));
}
/// #else
const rerun = rerunner(setup, driverFn, isolate);
rerun(main as any);

if (module.hot) {
    module.hot.accept('./app', () => {
        const newApp = require('./app').App;

        rerun(onionify(newApp));
    });
github cyclejs-community / cyclejs-sortable / docs / examples / simple / src / index.ts View on Github external
li('.li', '', ['Option 6'])
            ])
        )
        .compose(
            makeSortable>(DOM, {
                ghostClass: '.ghost',
                selectionDelay: 500
            })
        );

    return {
        DOM: vdom$
    };
}

run(main, {
    DOM: makeDOMDriver('#app')
});
github shinima / trips-editor / src / main.tsx View on Github external
import './preloaded'
import { makeDOMDriver } from '@cycle/dom'
import { run } from '@cycle/run'
import 'normalize.css'
import App from './App'
import makeDOMRectDriver from './makeDOMRectDriver'
import makeFileDriver from './makeFileDriver'
import makeFileSaverDriver from './makeFileSaverDriver'
import makeKeyboardDriver from './makeKeyboardDriver'
import makeWindowEventDriver from './makeWindowEventDriver'

run(App, {
  DOM: makeDOMDriver('#container'),
  FILE: makeFileDriver(),
  keyboard: makeKeyboardDriver(),
  mouseup: makeWindowEventDriver('mouseup'),
  mousemove: makeWindowEventDriver('mousemove'),
  SAVE: makeFileSaverDriver(),
  svgDOMRect: makeDOMRectDriver('.svg'),
})
github cyclejs / cyclejs / examples / intermediate / bmi-typescript / src / index.ts View on Github external
import {run} from '@cycle/run';
import {makeDOMDriver} from '@cycle/dom';
import BmiCalculator from './BmiCalculator';

const main = BmiCalculator;

run(main, {
  DOM: makeDOMDriver('#main-container'),
});
github cyclejs / cyclejs / examples / advanced / nested-folders / src / main.js View on Github external
import {run} from '@cycle/run'
import {makeDOMDriver} from '@cycle/dom'
import onionify from 'cycle-onionify'
import Folder from './Folder'

const main = onionify(Folder)

run(main, {
  DOM: makeDOMDriver('#app')
})
github cyclejs-community / cyclejs-sortable / examples / updateEvent / src / index.ts View on Github external
.compose(makeSortable>(DOM));

    const update$ : Stream = getUpdateEvent(DOM, '.ul')
        .map(o => 'You changed item Number ' + (o.oldIndex + 1) + ' to postion ' + (o.newIndex + 1))
        .startWith('You havent changed anything yet')
        .map(s => span('.span', s));

    const vdom$ : Stream = xs.combine(sortable$, update$)
        .map(arr => div([arr[0], arr[1]]));

    return {
        DOM: vdom$
    };
}

run(main, {
    DOM: makeDOMDriver('#app')
});
github kylecordes / cycle-example-1 / src / index.ts View on Github external
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);
github cyclejs-community / cyclejs-sortable / examples / parentSelector / src / index.ts View on Github external
li('.class', '', ['Option 4']),
                li('.class', '', ['Option 5']),
                li('.class', '', ['Option 6']),
            ])
        ])
    )
    .compose(makeSortable>(DOM, {
        parentSelector: '.ul'
    }));

    return {
        DOM: vdom$
    };
}

run(main, {
    DOM: makeDOMDriver('#app')
});
github cyclejs / cyclejs / examples / advanced / animated-letters / src / main.js View on Github external
ul({style: ulStyle}, animStates.map(animState =>
      li({style: {fontSize: `${animState.value * 50}px`}}, animState.key)
    ))
  )
}

function main(sources) {
  const key$ = intent(sources.Keydown)
  const state$ = model(key$)
  const vtree$ = view(state$, sources.Time)
  return {
    DOM: vtree$,
  }
}

run(main, {
  Keydown: () => fromEvent(document, 'keydown'),
  DOM: makeDOMDriver('#main-container'),
  Time: timeDriver
})
github cyclejs / cyclejs / examples / advanced / isomorphic / client.js View on Github external
import {makeDOMDriver} from '@cycle/dom';
import app from './app';

function clientSideApp(sources) {
  const sinks = app(sources);
  sinks.DOM = sinks.DOM.drop(1);
  return sinks;
}

function preventDefaultDriver(ev$) {
  ev$.addListener({
    next: ev => ev.preventDefault(),
  });
}

run(clientSideApp, {
  DOM: makeDOMDriver('.app-container'),
  context: () => xs.of(window.appContext),
  PreventDefault: preventDefaultDriver,
});

@cycle/run

The Cycle.js run() function to use with xstream

MIT
Latest version published 3 years ago

Package Health Score

65 / 100
Full package analysis