Skip to content

Instantly share code, notes, and snippets.

@piuccio
Created February 6, 2013 19:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save piuccio/4724995 to your computer and use it in GitHub Desktop.
Save piuccio/4724995 to your computer and use it in GitHub Desktop.
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