Created
February 14, 2017 05:24
-
-
Save wyqydsyq/923e0799eb4654f0b154fb2c4a9458d8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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