property inheritance: don't add eventlistener when not needed
This commit is contained in:
parent
49dc77ec65
commit
b0d5a8e06b
1 changed files with 20 additions and 12 deletions
|
|
@ -59,19 +59,27 @@ module.exports = class _widgets_base {
|
|||
}
|
||||
}
|
||||
|
||||
$('body').on(`widget-created.${this.hash}`, (e)=>{
|
||||
var {id} = e
|
||||
if (this.linkedProps[id] && id != this.getProp('id')) {
|
||||
this.checkPropsChanged(this.linkedProps[id])
|
||||
}
|
||||
})
|
||||
if (Object.keys(this.linkedProps).length) {
|
||||
|
||||
$('body').on(`change.${this.hash}`, (e)=>{
|
||||
var {id} = e
|
||||
if (this.linkedPropsValue[id] && id != this.getProp('id')) {
|
||||
this.checkPropsChanged(this.linkedPropsValue[id])
|
||||
}
|
||||
})
|
||||
$('body').on(`widget-created.${this.hash}`, (e)=>{
|
||||
var {id} = e
|
||||
if (this.linkedProps[id] && id != this.getProp('id')) {
|
||||
this.checkPropsChanged(this.linkedProps[id])
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
if (Object.keys(this.linkedPropsValue).length) {
|
||||
|
||||
$('body').on(`change.${this.hash}`, (e)=>{
|
||||
var {id} = e
|
||||
if (this.linkedPropsValue[id] && id != this.getProp('id')) {
|
||||
this.checkPropsChanged(this.linkedPropsValue[id])
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
$('body').trigger({type: 'widget-created', id: this.getProp('id'), widget:this})
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue