mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-12-19 01:31:38 +00:00
added mix-out counterparts to mixin methods in actions.js...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
f2b7d68672
commit
b2a9fc1076
@ -458,8 +458,11 @@ module.MetaActions = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
// Mixin a set of actions into this...
|
||||||
|
//
|
||||||
// NOTE: if 'all' is set them mixin all the actions available,
|
// NOTE: if 'all' is set them mixin all the actions available,
|
||||||
// otherwise only mixin local actions...
|
// otherwise only mixin local actions...
|
||||||
|
//
|
||||||
// XXX test
|
// XXX test
|
||||||
mixin: function(from, all, all_attr_types){
|
mixin: function(from, all, all_attr_types){
|
||||||
if(all){
|
if(all){
|
||||||
@ -481,9 +484,52 @@ module.MetaActions = {
|
|||||||
|
|
||||||
return this
|
return this
|
||||||
},
|
},
|
||||||
mixinto: function(to, all, all_attr_types){
|
|
||||||
|
// Mixin a set of local actions into an object...
|
||||||
|
//
|
||||||
|
mixinTo: function(to, all, all_attr_types){
|
||||||
return this.mixin.call(to, this, all, all_attr_types)
|
return this.mixin.call(to, this, all, all_attr_types)
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
// Remove mixed in actions from this...
|
||||||
|
//
|
||||||
|
// NOTE: this will only remove local actions, inherited actions will
|
||||||
|
// not be affected...
|
||||||
|
// NOTE: this will not affect event handlers, they should be removed
|
||||||
|
// manually if needed...
|
||||||
|
//
|
||||||
|
// XXX not sure about these...
|
||||||
|
// XXX test
|
||||||
|
mixout: function(from, all, all_attr_types){
|
||||||
|
if(all){
|
||||||
|
var keys = []
|
||||||
|
for(var k in from){
|
||||||
|
keys.push(k)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
var keys = Object.keys(from)
|
||||||
|
}
|
||||||
|
|
||||||
|
var locals = Object.keys(this)
|
||||||
|
var that = this
|
||||||
|
keys.forEach(function(k){
|
||||||
|
var attr = from[k]
|
||||||
|
if((all_attr_types || attr instanceof Action)
|
||||||
|
// remove only local attrs...
|
||||||
|
&& locals.indexOf(k) >= 0){
|
||||||
|
delete that[k]
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
return this
|
||||||
|
},
|
||||||
|
|
||||||
|
// Remove a set of local mixed in actions from object...
|
||||||
|
//
|
||||||
|
mixoutFrom: function(to, all, all_attr_types){
|
||||||
|
return this.mixout.call(to, this, all, all_attr_types)
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user