Skip to content

Instantly share code, notes, and snippets.

@nin-jin nin-jin/cycle_hello.js
Last active Jan 26, 2017

Embed
What would you like to do?
CycleJS vs $mol
import {run} from '@cycle/xstream-run';
import {div, label, input, hr, h1, makeDOMDriver} from '@cycle/dom';
function main(sources) {
const sinks = {
DOM: sources.DOM.select('.field').events('input')
.map(ev => ev.target.value)
.startWith('')
.map(name =>
div([
label('Name:'),
input('.field', {attrs: {type: 'text'}}),
hr(),
h1('Hello ' + name),
])
)
};
return sinks;
}
run(main, { DOM: makeDOMDriver('#app-container') });
$my_hello $mol_list
rows /
<= Form $mol_labeler
title @ \Hello
content /
<= Name $mol_string
value <=> name \
<= Greeting $mol_view
dom_name \h1
sub /
<= greeting_prefix @ \Hello
<= name \
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.