mirror of
https://github.com/flynx/features.js.git
synced 2025-12-25 12:31:58 +00:00
notes -- preparing to revise .remove(..)...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
853b6ed123
commit
e50f1ccaef
@ -61,7 +61,8 @@ feature_set.Feature({
|
|||||||
|
|
||||||
// feature configuration (optional)
|
// feature configuration (optional)
|
||||||
// NOTE: if not present here this will be taken from .actions.config
|
// NOTE: if not present here this will be taken from .actions.config
|
||||||
// NOTE: this takes priority over .actions.config
|
// NOTE: this takes priority over .actions.config, it is not recommended
|
||||||
|
// to define both.
|
||||||
config: {
|
config: {
|
||||||
option: 'value',
|
option: 'value',
|
||||||
// ...
|
// ...
|
||||||
|
|||||||
17
features.js
17
features.js
@ -161,20 +161,28 @@ module.FeatureProto = {
|
|||||||
|
|
||||||
return this
|
return this
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// XXX need to revise this...
|
||||||
|
// - .mixout(..) is available directly from the object while
|
||||||
|
// .remove(..) is not...
|
||||||
|
// - might be a good idea to add a specific lifecycle actions to
|
||||||
|
// enable feautures to handle their removal correctly...
|
||||||
remove: function(actions){
|
remove: function(actions){
|
||||||
if(this.actions != null){
|
if(this.actions != null){
|
||||||
actions.mixout(this.actions)
|
actions.mixout(this.tag || this.actions)
|
||||||
}
|
}
|
||||||
|
|
||||||
if(this.handlers != null){
|
if(this.handlers != null){
|
||||||
actions.off('*', this.tag)
|
actions.off('*', this.tag)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// XXX
|
||||||
if(this.hasOwnProperty('remove') && this.setup !== FeatureProto.remove){
|
if(this.hasOwnProperty('remove') && this.setup !== FeatureProto.remove){
|
||||||
this.remove(actions)
|
this.remove(actions)
|
||||||
}
|
}
|
||||||
|
|
||||||
// remove feature DOM elements...
|
// remove feature DOM elements...
|
||||||
|
// XXX
|
||||||
actions.ribbons.viewer.find('.' + this.tag).remove()
|
actions.ribbons.viewer.find('.' + this.tag).remove()
|
||||||
|
|
||||||
return this
|
return this
|
||||||
@ -1001,6 +1009,13 @@ var FeatureSetProto = {
|
|||||||
|
|
||||||
return obj
|
return obj
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// XXX revise...
|
||||||
|
// ...the main problem here is that .mixout(..) is accesible
|
||||||
|
// directly from actions while the feature .remove(..) method
|
||||||
|
// is not...
|
||||||
|
// ...would be nice to expose the API to actions directly or
|
||||||
|
// keep it only in features...
|
||||||
remove: function(obj, lst){
|
remove: function(obj, lst){
|
||||||
lst = lst.constructor !== Array ? [lst] : lst
|
lst = lst.constructor !== Array ? [lst] : lst
|
||||||
var that = this
|
var that = this
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user