Object Class
Item Index
Methods
addProtectedMethod
-
methodName
-
method
Shortcut for defyning a method which will be considered
protected by createSafeProxy;
Usage: obj.addProtectedMethod("name", method)
to add function method to obj as property obj["name"].
Parameters:
-
methodName
StringThe name of the new property to be added to this object
WARNING: if Object[methodName] exists, then it will be overwritten. -
method
FunctionThe method body.
Returns:
addPublicMethod
-
methodName
-
method
Shortcut for defyning a method which will be considered
public by createSafeProxy;
Usage: obj.addPublicMethod("name", method)
to add function method to obj as property obj["name"].
Parameters:
-
methodName
StringThe name of the new property to be added to this object
WARNING: if Object[methodName] exists, then it will be overwritten. -
method
FunctionThe method body.
Returns:
clear
()
Object
chainable
Deletes every property from an object
Returns:
createSafeProxy
-
[canDestroy=false]
Creates and returns a safe proxy for the object passed, that will wrap around it and expose only those methods marked as public (i.e. those that are declared as enumerable).
Parameters:
-
[canDestroy=false]
Boolean optionalStates if the proxy consumer has the authority to call destroy on the original object;
We assume the convention that object's uses destroy method as their destructor.
Returns:
init
-
proto
-
[properties]
Creates an object inheriting from a given prototype and then, if required, inits it with a list of properties tha can be passed as its second argument.
Parameters:
-
proto
ObjectThe protetype to inherit from;
-
[properties]
Object optionalA dictionary of key-value properties to be used for the new object's initialization;
Returns:
isArray
-
obj
Checks if its argument is an array.
Parameters:
-
obj
ObjectThe argument to be checked.
Returns:
isFunction
-
arg
Checks if its argument is a Function.
Parameters:
-
arg
ObjectThe argument to be checked.
Returns:
isNumber
-
obj
Checks if its argument is a Number.
Parameters:
-
obj
ObjectThe argument to be checked.
Returns:
isString
-
obj
Checks if its argument is a string.
Parameters:
-
obj
ObjectThe argument to be checked.
Returns:
isUndefined
-
arg
Checks if its argument is undefined.
Parameters:
-
arg
ObjectThe argument to be checked.
Returns:
setProperty
-
property
-
value
Assign the value "value" to the property "property" of the current object.
"property" MUST be an existing property of current object or of its ancestors:
if this[property] is undefined, it recursively checks along its inheritance chain.
Parameters:
-
property
StringThe name of the property to look up for in this object and its super object.
-
value
ObjectThe value to be assigned to the property.
Returns:
shallowCopy
()
Object
Creates a new object (shallow)copying the elements of the current one.
Returns:
superMethod
-
methodName
-
[args]
Checks if the super object of this object has a method (i.e. a property which is a function) whose name is methodName, and then calls it. Otherwise checks recursively its super object, i.e. its prototype.
Parameters:
-
methodName
StringThe name of the method to look up for in this object's super objects.
-
[args]
Object optional multipleThe arguments to be passed to the super method, if any is needed;