made with esnextbin
Created
September 23, 2019 09:53
-
-
Save wh0am1-dev/46b62d55a3791ee2c0ef6381a4cc9ecc 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> | |
</head> | |
<body> | |
</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
const choo = require('choo') | |
const html = require('choo/html') | |
const css = require('sheetify') | |
css('tachyons') | |
const app = choo() | |
app.use((state, emitter) => { | |
state.count = 0 | |
emitter.on('counter:add', () => { | |
state.count += 1 | |
}) | |
emitter.on('counter:sub', () => { | |
state.count -= 1 | |
}) | |
}) | |
app.route('/', (state, emit) => { | |
return html` | |
<div>${state.count}</div> | |
<div> | |
<button onclick=${() => emit('counter:add')}>add</button> | |
<button onclick=${() => emit('counter:sub')}>sub</button> | |
</div> | |
` | |
}) | |
app.mount('body') |
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", | |
"version": "0.0.0", | |
"dependencies": { | |
"choo": "latest", | |
"sheetify": "latest", | |
"tachyons": "latest" | |
} | |
} |
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 _taggedTemplateLiteral2 = require('babel-runtime/helpers/taggedTemplateLiteral'); | |
var _taggedTemplateLiteral3 = _interopRequireDefault(_taggedTemplateLiteral2); | |
var _templateObject = (0, _taggedTemplateLiteral3.default)(['\n <div>', '</div>\n <div>\n <button onclick=', '>add</button>\n <button onclick=', '>sub</button>\n </div>\n '], ['\n <div>', '</div>\n <div>\n <button onclick=', '>add</button>\n <button onclick=', '>sub</button>\n </div>\n ']); | |
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | |
var choo = require('choo'); | |
var html = require('choo/html'); | |
var css = require('sheetify'); | |
css('tachyons'); | |
var app = choo(); | |
app.use(function (state, emitter) { | |
state.count = 0; | |
emitter.on('counter:add', function () { | |
state.count += 1; | |
}); | |
emitter.on('counter:sub', function () { | |
state.count -= 1; | |
}); | |
}); | |
app.route('/', function (state, emit) { | |
return html(_templateObject, state.count, function () { | |
return emit('counter:add'); | |
}, function () { | |
return emit('counter:sub'); | |
}); | |
}); | |
app.mount('body'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment