Skip to content

Instantly share code, notes, and snippets.

@tusharmath
Last active August 31, 2016 08:03
Show Gist options
  • Save tusharmath/7ca39ca144b97ecee6ccc426a729a760 to your computer and use it in GitHub Desktop.
Save tusharmath/7ca39ca144b97ecee6ccc426a729a760 to your computer and use it in GitHub Desktop.
esnextbin sketch
<!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>
// 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"
))
}
})
{
"name": "esnextbin-sketch",
"dependencies": {
"hyperscript": "2.0.2",
"babel-runtime": "6.11.6"
},
"version": "0.0.0"
}
'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