These 2 functions can be used by you, but as they are not documented, they might change over time, we don't recommend that you use it. Use it at your own risk.
The
overloadSetter grabs a normal function that accepts 2 arguments, a key and a value and turns it into a function that can accept an object as the parameters too.
so, for example:
Function.prototype.extend = function(key, value){
this[key] = value;
};
This will make the extend function accept a key and a value that will be attached to "this" function. Like this:
function(){}.extend('key', 'value');
When you do:
Function.prototype.extend = function(key, value){
this[key] = value;
}.overloadSetter();
The function will be able to accept an object too and it will be possible to use it like this:
function(){}.extend({'key': 'value'});
The
overloadGetter function will transform a function that receives one string and returns one value, like the get function:
get: function(prop){
var property = Element.Properties[prop];
return (property && property.get) ? property.get.apply(this) : this.getProperty(prop);
}.overloadGetter()
Into a function that can accept an array or multiple arguments, so you can use it this:
get('p1', 'p2', 'p3', ...) or get(['p1', 'p2', 'p3', ...])
Hope it's clear.
Again, avoid using it for public projects.
--
Fábio Miranda Costa
frontend@portalpadroes
Globo.com
github: fabiomcosta
twitter: @fabiomiranda
ramal: 6410