Skip to content

Instantly share code, notes, and snippets.

@wyqydsyq
Created February 14, 2017 05:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wyqydsyq/923e0799eb4654f0b154fb2c4a9458d8 to your computer and use it in GitHub Desktop.
Save wyqydsyq/923e0799eb4654f0b154fb2c4a9458d8 to your computer and use it in GitHub Desktop.
import Cycle from '@cycle/xstream-run'
import { makeDOMDriver } from '@cycle/dom'
import { timeDriver } from '@cycle/time'
const { rerunner, restartable } = require('cycle-restart')
import Main from './main'
const getMain = () => require('./main').default
const getDrivers = () => ({
DOM: restartable(makeDOMDriver('#main'), {pauseSinksWhileReplaying: false}),
Time: timeDriver
})
const drivers = getDrivers()
let run = rerunner(Cycle.run)
run(Main, getDrivers())
if (module['hot']) {
module['hot'].accept('./main', () => {
const newMain = getMain()
run(newMain, getDrivers())
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment