mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-11-03 12:50:09 +00:00
minor tweaks...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
b9e25f0c03
commit
c8e9bbc006
@ -97,32 +97,44 @@ proxyMethods(ClientPrototype)
|
||||
|
||||
|
||||
// XXX auto apply this...
|
||||
function chainSelfAttrMethods(cls, attr, meth){
|
||||
function chainSelfAttrMethod(cls, attr, name, func){
|
||||
return function(){
|
||||
// NOTE: this is super, python-style but without multiple
|
||||
// inheritance...
|
||||
// ...that last part makes this more of a code reuse
|
||||
// than a programming tool...
|
||||
cls.__proto__[meth].apply(this, arguments)
|
||||
cls.__proto__[name].apply(this, arguments)
|
||||
// call the encapsulated method...
|
||||
this[attr][meth].apply(this[attr], arguments)
|
||||
this[attr][name].apply(this[attr], arguments)
|
||||
if(func != null){
|
||||
return func.apply(this, arguments)
|
||||
}
|
||||
return this
|
||||
}),
|
||||
}
|
||||
|
||||
function chainSelfAttrMethods(obj, map){
|
||||
for(var attr in map){
|
||||
var methods = map[attr]
|
||||
for(var name in methods){
|
||||
obj[name] = doc(methods[name], chainSelfAttrMethod(obj, attr, name))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
var ViewerPrototype = {
|
||||
// this expects the folowing attrs:
|
||||
//
|
||||
// .ribbons
|
||||
//
|
||||
|
||||
focusImage: doc('Focus image',
|
||||
chainSelfAttrMethods(ViewerPrototype, 'ribbons', 'focusImage')),
|
||||
focusRibbon: doc('Focus ribbon',
|
||||
chainSelfAttrMethods(ViewerPrototype, 'ribbons', 'focusRibbon')),
|
||||
|
||||
}
|
||||
chainSelfAttrMethods(ViewerPrototype, {
|
||||
ribbons: {
|
||||
focusImage: 'Focus image',
|
||||
focusRibbon: 'Focus ribbon',
|
||||
},
|
||||
})
|
||||
ViewerPrototype.__proto__ = ClientPrototype
|
||||
|
||||
|
||||
|
||||
@ -3,6 +3,9 @@
|
||||
* Data generation 4 implementation.
|
||||
*
|
||||
*
|
||||
* XXX might be a good idea to make a set of universal argument parsing
|
||||
* utils...
|
||||
*
|
||||
**********************************************************************/
|
||||
|
||||
define(function(require){ var module = {}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user