Skip to content

Commit

Permalink
readme fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Bradley Meck committed May 27, 2010
1 parent d67b0a3 commit ce710ea
Showing 1 changed file with 29 additions and 17 deletions.
46 changes: 29 additions & 17 deletions README.TXT
@@ -1,19 +1,31 @@
node-watchable
@exports
Watchabe(onGet,onSet) - Supplies getter and setter callbacks across all the properties
#node-watchable
##exports
* Watchable(onGet,onSet)
Supplies getter and setter callbacks across all the properties
Currently both callbacks are required

@example
//print out any property gets that use the . operator
var debug = Watchable(
function(propertyName,value,hadAlready){
//check the type of the object contained by value
//undefined if no value, or number if using []'s with a number
if(typeof value === "string") {
sys.puts(propertyName);
}
return value;
##example
Code
//print out any property gets that use the . operator
var debug = Watchable(
function(propertyName,value,hadAlready){
//check the type of the object contained by value
//undefined if no value, or number if using []'s with a number
if(typeof value === "string") {
sys.puts(propertyName);
}
function(propertyName,oldValue,value,hadAlready) {
return value;
}
)
return value;
}
function(propertyName,oldValue,value,hadAlready) {
return value;
}
)
debug.hello
debug[" world!"]
Output
hello
world!

##uses
1. Debugging - Show what is being accessed / set
2. False natives - refuse to allow properties to be set / got beyond a specified few

0 comments on commit ce710ea

Please sign in to comment.