Skip to content

Instantly share code, notes, and snippets.

@k33g
Created February 2, 2011 08:03
Show Gist options
  • Save k33g/807392 to your computer and use it in GitHub Desktop.
Save k33g/807392 to your computer and use it in GitHub Desktop.
use of "Annotations for js"
function Human(){
/* @@-FirstName-
myType:TEXT,
myDefaultValue:John
@@ */
this.FirstName;
/* @@-LastName-
myType:TEXT,
myDefaultValue:Doe
@@ */
this.LastName;
this.toString = function(){
return this.FirstName+" "+this.LastName;
}
}
var h = new Human();
console.log(Annotations(Human));
h.FirstName = Annotations(Human)['FirstName']['myDefaultValue']; /*display John*/
h.LastName = Annotations(Human).LastName.myDefaultValue; /*display Doe*/
console.log(h.toString()); /*display John Doe*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment