Skip to content

Instantly share code, notes, and snippets.

@piuccio piuccio/console.js
Created Feb 6, 2013

Embed
What would you like to do?
hashspace Event callbacks as literals
// Event callbacks don't need a refresh, they trigger one automatically
log();
function increase (person, howMuch) {
json.set(person, "age", person.age + howMuch);
}
var person = {
name : "Alfred",
age : 10
};
# template welcome(person)
{person.name} 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
You can’t perform that action at this time.