Skip to content

Instantly share code, notes, and snippets.



Created Feb 6, 2013
What would you like to do?
hashspace Event callbacks as literals
// Event callbacks don't need a refresh, they trigger one automatically
function increase (person, howMuch) {
json.set(person, "age", person.age + howMuch);
var person = {
name : "Alfred",
age : 10
# template welcome(person)
{} is now {person.age} years old.
<br />
<button onclick="{increase(person, 1)}">One year older</button>
<button onclick="{increase(person, 5)}">Five years older</button>
# /template
display(welcome, [person]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment