Skip to content

Instantly share code, notes, and snippets.

@r7kamura
Last active October 3, 2015 11:11
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 r7kamura/59c394af95f35668085c to your computer and use it in GitHub Desktop.
Save r7kamura/59c394af95f35668085c to your computer and use it in GitHub Desktop.
import Cycle, { Rx } from '@cycle/core'
import { h, makeDOMDriver } from '@cycle/dom';
const intent = (DOM) => {
return {};
};
const model = (actionMap) => {
return new Rx.Subject().startWith(1);
};
const view = (stateStream) => {
return stateStream.map((state) => {
return h('div', [
'test'
]);
});
};
const main = ({ DOM }) => {
const actionMap = intent(DOM);
const stateStream = model(actionMap);
const treeStream = view(stateStream);
return {
DOM: treeStream
};
};
Cycle.run(main, {
DOM: makeDOMDriver('.root')
});
@r7kamura
Copy link
Author

r7kamura commented Oct 3, 2015

.root の中に「test」と表示するだけのサンプル

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment