flexSetter( setter ) : 函数
这是一个ExtJS构架中普遍使用的方法。它对其它函数起到一个封装的作用,封装前的函数原本只接收name和value两个参数,而封装后可以允许一个或多个值的设置,设置方法为以下两个之一:
1.参数仍为name和value
2.包含多个键值对的对象
A very commonly used method throughout the framework. It acts as a wrapper around another method which originally accepts 2 arguments for name
and value
. The wrapped function then allows "flexible" value setting of either:
name
andvalue
as 2 arguments- one single object argument with multiple key - value pairs
For example:
var setValue = Ext.Function.flexSetter(function(name, value) {
this[name] = value;
});
// Afterwards
// Setting a single name - value
setValue('name1', 'value1');
// Settings multiple name - value pairs
setValue({
name1: 'value1',
name2: 'value2',
name3: 'value3'
});
Parameters
- setter : Function
Returns
- Function
flexSetter