##Watchable(onGet,onSet,onForeach,onQuery,onDelete)
Callback's can use the this object in order to act normally without reinvoking themselves.
- Value onGet(ArgInfo) - property
Returns the value at a specific index
- Value onSet(ArgInfo) - property, value
Returns the value to save at a specific index
Returns an array containing all the index keys for this object
- Boolean onQuery(ArgInfo) - property
Returns whether the object has a specific index
- Boolean onDelete(ArgInfo) - property
Returns whether the object was successful in deleting a specific index
- ArgInfo Values - holder thisObject property? value?
RePrototype(obj,proto)
Set obj's prototype to proto
Partial implementation of ES Harmony Proxy API.
##ReadOnly(obj,mask)
Prevent an object from being modified w/ a setter. Methods on this object may still modify the object.
- mask - list of properties to intercept properties (useful to replace methods you dont want to modify the object)
- ReadOnly.ArrayMask - prevents Array Object from being modified by methods
- ReadOnly.DateMask - prevent Date Object from being modified by methods
####Code
var proxied={hello:""}
var debug = Watchable(
//GETTER
function(ArgInfo){
//check the type of the object contained by value
//undefined if no value, or number if using []'s with a number
var property=ArgInfo.property
sys.puts("GET:"+JSON.stringify(property),"VALUE:"+String(proxied[property]));
return proxied[property];
}
//SETTER
, function(ArgInfo) {
var property=ArgInfo.property
var value=ArgInfo.value
sys.puts("GET:"+JSON.stringify(property),"VALUE:"+String(proxied[property]),"NEW VALUE:"+String());
pro
return ArgInfo.value;
}
)
debug.hello
debug[" world!"]=true