made with esnextbin
Last active
August 31, 2016 08:03
-
-
Save tusharmath/7ca39ca144b97ecee6ccc426a729a760 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 --> | |
<funag-swipeable-cards> | |
<card>AAA</card> | |
<card>BBB</card> | |
<card>CCC</card> | |
</funag-swipeable-cards> | |
</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 h from 'hyperscript' | |
const registerWC = (name, proto) => { | |
const prototype = Object.assign(Object.create(HTMLElement.prototype), proto) | |
document.registerElement(name, {prototype}) | |
} | |
registerWC('funag-swipeable-cards', { | |
createdCallback () { | |
const shadowRoot = this.createShadowRoot() | |
shadowRoot.appendChild(h('div.container', | |
"This is a test" | |
)) | |
} | |
}) |
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": { | |
"hyperscript": "2.0.2", | |
"babel-runtime": "6.11.6" | |
}, | |
"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 _create = require('babel-runtime/core-js/object/create'); | |
var _create2 = _interopRequireDefault(_create); | |
var _extends2 = require('babel-runtime/helpers/extends'); | |
var _extends3 = _interopRequireDefault(_extends2); | |
var _hyperscript = require('hyperscript'); | |
var _hyperscript2 = _interopRequireDefault(_hyperscript); | |
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | |
var registerWC = function registerWC(name, proto) { | |
var prototype = (0, _extends3.default)((0, _create2.default)(HTMLElement.prototype), proto); | |
document.registerElement(name, { prototype: prototype }); | |
}; // write ES2015 code and import modules from npm | |
// and then press "Execute" to run your program | |
registerWC('funag-swipeable-cards', { | |
createdCallback: function createdCallback() { | |
var shadowRoot = this.createShadowRoot(); | |
shadowRoot.appendChild((0, _hyperscript2.default)('div.container', "This is a test")); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment