Refactor ItemPaneSection#_handleDataChange
Remove unused _handleDataChange and rename it to _handleItemChange
This commit is contained in:
parent
db499fdf2b
commit
ee6b9d7af7
1 changed files with 6 additions and 17 deletions
|
@ -30,9 +30,8 @@ class ItemPaneSectionElementBase extends XULElementBase {
|
|||
}
|
||||
|
||||
set item(item) {
|
||||
let success = this._handleDataChange("item", this._item, item);
|
||||
if (success === false) return;
|
||||
this._item = item;
|
||||
if (this._handleItemChange) this._handleItemChange();
|
||||
}
|
||||
|
||||
get editable() {
|
||||
|
@ -49,9 +48,8 @@ class ItemPaneSectionElementBase extends XULElementBase {
|
|||
}
|
||||
|
||||
set tabType(tabType) {
|
||||
let success = this._handleDataChange("tabType", this._tabType, tabType);
|
||||
if (success === false) return;
|
||||
this._tabType = tabType;
|
||||
this.setAttribute('tabType', tabType);
|
||||
}
|
||||
|
||||
connectedCallback() {
|
||||
|
@ -76,13 +74,6 @@ class ItemPaneSectionElementBase extends XULElementBase {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns {boolean} if false, data change will not be saved
|
||||
*/
|
||||
_handleDataChange(_type, _value) {
|
||||
return true;
|
||||
}
|
||||
|
||||
_handleSectionToggle = async (event) => {
|
||||
if (event.target !== this._section || !this._section.open) {
|
||||
return;
|
||||
|
@ -334,13 +325,11 @@ class ItemPaneSectionElementBase extends XULElementBase {
|
|||
this._hooks.toggle(props);
|
||||
};
|
||||
|
||||
_handleDataChange(type, _oldValue, _newValue) {
|
||||
if (type == "item" && this._hooks.itemChange) {
|
||||
_handleItemChange() {
|
||||
if (!this._hooks.itemChange) return;
|
||||
let props = this._assembleProps(this._getHookProps());
|
||||
this._hooks.itemChange(props);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
customElements.define("item-pane-custom-section", ItemPaneCustomSection);
|
||||
|
|
Loading…
Reference in a new issue