Created
April 16, 2016 13:30
-
-
Save avanslaars/e72e49deaeede6cbcad86b4dc2c26eaa to your computer and use it in GitHub Desktop.
Boilerplate code for Motorcycle on Webpackbin.com - This is a direct port of the CycleJS boilerplate to Motorcycle
This file contains hidden or 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
//http://www.webpackbin.com/VkPA2Qj1Z | |
import Motorcycle from '@motorcycle/core'; | |
import {div, label, input, hr, h1, makeDOMDriver} from '@motorcycle/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', {attributes: {type: 'text'}}), | |
hr(), | |
h1('Hello ' + name) | |
]) | |
) | |
}; | |
return sinks; | |
} | |
Motorcycle.run(main, { DOM: makeDOMDriver('#app') }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment