mirror of
https://github.com/flynx/features.js.git
synced 2025-12-25 04:21: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)
|
||||
// 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: {
|
||||
option: 'value',
|
||||
// ...
|
||||
|
||||
17
features.js
17
features.js
@ -161,20 +161,28 @@ module.FeatureProto = {
|
||||
|
||||
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){
|
||||
if(this.actions != null){
|
||||
actions.mixout(this.actions)
|
||||
actions.mixout(this.tag || this.actions)
|
||||
}
|
||||
|
||||
if(this.handlers != null){
|
||||
actions.off('*', this.tag)
|
||||
}
|
||||
|
||||
// XXX
|
||||
if(this.hasOwnProperty('remove') && this.setup !== FeatureProto.remove){
|
||||
this.remove(actions)
|
||||
}
|
||||
|
||||
// remove feature DOM elements...
|
||||
// XXX
|
||||
actions.ribbons.viewer.find('.' + this.tag).remove()
|
||||
|
||||
return this
|
||||
@ -1001,6 +1009,13 @@ var FeatureSetProto = {
|
||||
|
||||
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){
|
||||
lst = lst.constructor !== Array ? [lst] : lst
|
||||
var that = this
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user