Created
February 6, 2013 19:16
-
-
Save piuccio/4724995 to your computer and use it in GitHub Desktop.
hashspace Event callbacks as literals
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Event callbacks don't need a refresh, they trigger one automatically | |
log(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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