Skip to content

Commit a01933f

Browse files
author
Bradley Meck
committed
readme example fix
1 parent 1d861ae commit a01933f

File tree

1 file changed

+18
-14
lines changed

1 file changed

+18
-14
lines changed

README.md

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -68,22 +68,26 @@ Partial implementation of ES Harmony Proxy API.
6868
##example
6969

7070
####Code
71-
var proxied={hello:""}
72-
var debug = Watchable(
73-
//GETTER
74-
function(ArgInfo){
71+
var Watchable = require( "../lib/overload" ).Watchable
72+
, proxied={ hello : "" }
73+
, debug = Watchable(
74+
function getter( ArgInfo ){
7575
//check the type of the object contained by value
7676
//undefined if no value, or number if using []'s with a number
77-
var property=ArgInfo.property
78-
sys.puts("GET:"+JSON.stringify(property),"VALUE:"+String(proxied[property]));
79-
return proxied[property];
77+
var property = ArgInfo.property
78+
assert.equal( property, "hello", "GETTER PROPERTY NAME" )
79+
console.log( "GET:" + JSON.stringify( property ) )
80+
console.log( "VALUE:" + String(proxied[ property ] ) )
81+
return proxied[ property ];
8082
}
81-
//SETTER
82-
, function(ArgInfo) {
83-
var property=ArgInfo.property
84-
var value=ArgInfo.value
85-
sys.puts("GET:"+JSON.stringify(property),"VALUE:"+String(proxied[property]),"NEW VALUE:"+String());
86-
pro
83+
, function setter( ArgInfo ) {
84+
var property = ArgInfo.property
85+
assert.equal( property, " world!", "SETTER PROPERTY NAME" )
86+
var value = ArgInfo.value
87+
assert.equal( value, true, "SETTER PROPERTY VALUE" )
88+
console.log( "GET:"+JSON.stringify( property ) )
89+
console.log( "VALUE:"+String( proxied[ property ] ) )
90+
console.log( "NEW VALUE:" + String( value ) )
8791
return ArgInfo.value;
8892
}
8993
)
@@ -96,7 +100,7 @@ Partial implementation of ES Harmony Proxy API.
96100
VALUE:
97101
SET:" world!"
98102
VALUE:undefined
99-
VALUE:true
103+
NEW VALUE:true
100104

101105
##uses
102106

0 commit comments

Comments
 (0)