made with esnextbin
Last active
August 14, 2016 19:27
-
-
Save tusharmath/fd618a77d68e3919821a6573ee9e348a to your computer and use it in GitHub Desktop.
esnextbin sketch
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
<!doctype html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>ESNextbin Sketch</title> | |
<!-- put additional styles and scripts here --> | |
</head> | |
<body> | |
<!-- put markup and other contents here --> | |
<div id="container"></div> | |
</body> | |
</html> |
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
// write ES2015 code and import modules from npm | |
// and then press "Execute" to run your program | |
import {Observable as O} from 'rx' | |
import {h, component, createProjector} from 'maquette' | |
const projector = createProjector() | |
function renderMaquette () { | |
return NavBar.map({name: 'Tushar'}) | |
} | |
function createComponent (render) { | |
return { | |
map (func) { | |
return render(data) | |
} | |
} | |
} | |
const NavBar = createComponent($ => h('div', [ | |
h('h1', ['Hello', $.name]), | |
h('button', ['click!']), | |
h('input', {placeholder: 'Type something here'}), | |
])) | |
projector.append(document.getElementById('container'), renderMaquette); |
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
{ | |
"name": "esnextbin-sketch", | |
"dependencies": { | |
"rx": "4.1.0", | |
"maquette": "2.3.5" | |
}, | |
"version": "0.0.0" | |
} |
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
'use strict'; | |
var _rx = require('rx'); | |
var _maquette = require('maquette'); | |
// write ES2015 code and import modules from npm | |
// and then press "Execute" to run your program | |
var projector = (0, _maquette.createProjector)(); | |
function renderMaquette() { | |
return NavBar.map({ name: 'Tushar' }); | |
} | |
function createComponent(render) { | |
return { | |
map: function map(func) { | |
return render(data); | |
} | |
}; | |
} | |
var NavBar = createComponent(function ($) { | |
return (0, _maquette.h)('div', [(0, _maquette.h)('h1', ['Hello', $.name]), (0, _maquette.h)('button', ['click!']), (0, _maquette.h)('input', { placeholder: 'Type something here' })]); | |
}); | |
projector.append(document.getElementById('container'), renderMaquette); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment