DEV Community

artydev
artydev

Posted on

Meiosis in action

Another post on Meiosis pattern. If you want some details, feel free to comment.

/* @jsx m */

import m from "mithril";
import stream from "mithril-stream";
import merge from "mergerino";
import Actions from "../src/actions";
import View from "../src/view";

const InitialState = {
  counter: 0,
  angle: 0
};

const update = stream();
const states = stream.scan(merge, InitialState, update);
const actions = Actions(update);

const app = document.getElementById("app");

states.map(() => m.render(app, <h1>{View(states, actions)}</h1>));

/* Test */
setInterval(actions.testit, 0);

Fork it and spread it :-)
Edit codebarre

Latest comments (0)