How to use the @cycle/time.timeDriver function in @cycle/time

To help you get started, we’ve selected a few @cycle/time 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 cyclejs / cycle-time-travel / src / time-travel.ts View on Github external
function run (app, makeDrivers) {
  const Time = timeDriver(null, null);

  const newMakeDrivers = () => {
    const drivers = makeDrivers();

    drivers.Time = () => Time;

    return drivers;
  }

  const rerun = rerunner(originalRun, newMakeDrivers);

  const stuff = rerun(app);

  const awesomeStreams = streamGraph(stuff.sinks);

  function InnerApp (sources) {
github Widdershin / cycle-restart / src / restart.js View on Github external
function restart (setup, main, drivers, cb, {sources, sinks, dispose}, isolate = {}, timeToTravelTo = null) {
  dispose();

  if (typeof isolate === 'function' && 'reset' in isolate) {
    isolate.reset();
  }

  const realTime = timeDriver();
  realTime._pause();

  drivers.Time = () => realTime;

  for (let driverName in drivers) {
    const driver = drivers[driverName];

    const newDriver = (sink$) => driver(sink$, realTime);

    newDriver.replayLog = driver.replayLog;
    newDriver.onPostReplay = driver.onPostReplay;
    newDriver.log$ = driver.log$;

    drivers[driverName] = newDriver;

    if (driver.onPreReplay) {
github Widdershin / cycle-restart / src / restart.js View on Github external
return function(main, cb = noop, timeToTravelTo = null) {
    if (first) {
      drivers = driversFn();

      let realTime = timeDriver();
      drivers.Time = () => realTime;

      for (let driverName in drivers) {
        const driver = drivers[driverName];

        const newDriver = (sink$) => driver(sink$, realTime);

        drivers[driverName] = newDriver;
      }

      const {sources, sinks, run} = Cycle(main, drivers);

      realTime = sources.Time;

      const dispose = run();

@cycle/time

A time driver designed to enable awesome testing and dev tooling

MIT
Latest version published 4 years ago

Package Health Score

59 / 100
Full package analysis