Skip to content

Commit 231b03b

Browse files
author
Bradley Meck
committed
readme update
1 parent 764ac99 commit 231b03b

File tree

1 file changed

+65
-18
lines changed

1 file changed

+65
-18
lines changed

README.md

Lines changed: 65 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,104 @@
11
#Node-Overload
22

3+
##install
4+
5+
####If you have npm
6+
1. npm install overload
7+
8+
####Raw
9+
1. run __make__
10+
2. files are in lib directory
11+
312
##exports
413

14+
####overload.node
15+
516
* Watchable(onGet,onSet,onForeach,onQuery,onDelete)
617

718
Callback's can use the __this__ object in order to act normally without reinvoking themselves.
819

9-
* Value onGet(String propertyName, Value value, hadAlready)
20+
* * Value onGet(ArgInfo) - property
1021

1122
Returns the value at a specific index
12-
* Value onSet(String propertyName, Value oldValue, Value value, hadAlready)
23+
* * Value onSet(ArgInfo) - property, value
1324

1425
Returns the value to save at a specific index
15-
* Array onForeach()
26+
* * Array onForeach(ArgInfo)
1627

1728
Returns an array containing all the index keys for this object
18-
* Boolean onQuery(String propertyName, Value value, hadAlready)
29+
* * Boolean onQuery(ArgInfo) - property
1930

2031
Returns whether the object has a specific index
21-
* Boolean onDelete(String propertyName, Value value, hadAlready)
32+
* * Boolean onDelete(ArgInfo) - property
2233

2334
Returns whether the object was successful in deleting a specific index
2435

36+
* * ArgInfo Values - holder thisObject property? value?
37+
38+
* RePrototype(obj,proto)
39+
40+
Set obj's prototype to proto
41+
42+
####proxy.js
43+
44+
Partial implementation of ES Harmony Proxy API.
45+
46+
####utils.js
47+
48+
* ReadOnly(obj,mask)
49+
50+
Prevent an object from being modified w/ a setter. Methods on this object may still modify the object.
51+
52+
* * mask - list of properties to intercept properties (useful to replace methods you dont want to modify the object)
53+
54+
* * ReadOnly.ArrayMask
55+
56+
* * ReadOnly.DateMask
2557

2658
##example
2759

2860
####Code
29-
30-
//print out any property gets that use the . operator
61+
var proxied={hello:""}
3162
var debug = Watchable(
32-
function(propertyName,value,hadAlready){
63+
//GETTER
64+
function(ArgInfo){
3365
//check the type of the object contained by value
3466
//undefined if no value, or number if using []'s with a number
35-
if(typeof value === "string") {
36-
sys.puts(propertyName);
37-
}
38-
return value;
67+
var property=ArgInfo.property
68+
sys.puts("GET:"+JSON.stringify(property),"VALUE:"+String(proxied[property]));
69+
return proxied[property];
3970
}
40-
function(propertyName,oldValue,value,hadAlready) {
41-
return value;
71+
//SETTER
72+
, function(ArgInfo) {
73+
var property=ArgInfo.property
74+
var value=ArgInfo.value
75+
sys.puts("GET:"+JSON.stringify(property),"VALUE:"+String(proxied[property]),"NEW VALUE:"+String());
76+
pro
77+
return ArgInfo.value;
4278
}
4379
)
4480
debug.hello
45-
debug[" world!"]
81+
debug[" world!"]=true
4682

4783
####Output
4884

49-
hello
50-
world!
85+
GET:"hello"
86+
VALUE:
87+
SET:" world!"
88+
VALUE:undefined
89+
VALUE:true
5190

5291
##uses
5392

93+
* Watchable
5494
1. Debugging - Show what is being accessed / set
5595
2. False natives - refuse to allow properties to be set / got beyond a specified few
5696
3. Dynamic programming - Fib[3] could compute Fib[1] and Fib[2]
57-
4. Index based getters / setters - Fib[0] cannot have a getter set normally because it is a number not string based index (all non-number non-undefined values become string based).
97+
4. Index based getters / setters - Fib[0] cannot have a getter set normally because it is a number not string based index (all non-number non-undefined values become string based).
98+
99+
* RePrototype
100+
1. Making Watchables follow the instanceof operator
101+
2. Making extensions of Objects follow the instanceof operator
102+
103+
* ReadOnly
104+
1. Making arrays that cant be messed with

0 commit comments

Comments
 (0)