Skip to content

Instantly share code, notes, and snippets.

var Form = require('form');
function PersonalDetails(el, model) {
this.el = el;
this.model = model;
this.form = new Form(el);
}
var main = document.querySelector('#main-nav');
parent.addEventListener('click', function(e){
if(e.target.matches('.toggleNav')) {
e.preventDefault();
main.classList.toggle('in');
}
});
;(function(){
/**
* Require the module at `name`.
*
* @param {String} name
* @return {Object} exports
* @api public
*/
function update (data) {
var request = new XMLHttpRequest();
request.open('POST', '/whatevers', true);
request.send(data);
}
var View = ripple(template)
.use(events);
// Might need different change events for each field
.u-enableKerning {
text-rendering: optimizeLegibility;
font-feature-settings: "kern" 1;
font-kerning: normal;
}
@anthonyshort
anthonyshort / es6.js
Last active August 29, 2015 14:08
vdom
import Component from "tron";
class MyThing extends Component {
initialState(){
return { open: false }
}
mounted(parent, el) {
console.log("omg I'm in the dom")
}
onClick(event) {
{
type: 'element',
tagName: 'div',
attributes: { class: 'foo' },
children: [{
type: 'element',
tagName: 'span',
attributes: {},
children: []
}]
import styles from './styles.css'
export default ({props,state}) => {
<div>
<style scoped>{styles}</style>
<h1>Hello World</h1>
</div>
}
@anthonyshort
anthonyshort / index.js
Last active August 29, 2015 14:22 — forked from marklundin/index.js
requirebin sketch
var deku = require( 'deku' );
// Create a component
var HelloWorld = {
render: function(c) {
return deku.element( 'div', {}, [c.props.text] );
}
}
// Create a tree
const Parent = {
render (component, updateState) {
function onChange () {
updateState({ parentChanged: 'yay' })
}
return <Child onChange={onChange} />
}
}