mirror of
https://github.com/shoelace-style/webawesome.git
synced 2026-01-12 12:09:26 +00:00
move init logic to connectedCallback
This commit is contained in:
@@ -66,14 +66,7 @@ export default class SlSplitPanel extends LitElement {
|
||||
super.connectedCallback();
|
||||
this.resizeObserver = new ResizeObserver(entries => this.handleResize(entries));
|
||||
this.updateComplete.then(() => this.resizeObserver.observe(this));
|
||||
}
|
||||
|
||||
disconnectedCallback() {
|
||||
super.disconnectedCallback();
|
||||
this.resizeObserver.unobserve(this);
|
||||
}
|
||||
|
||||
firstUpdated() {
|
||||
const { width, height } = this.getBoundingClientRect();
|
||||
this.size = this.vertical ? height : width;
|
||||
|
||||
@@ -84,6 +77,11 @@ export default class SlSplitPanel extends LitElement {
|
||||
this.positionPercentage = this.getPositionAsPercentage();
|
||||
}
|
||||
|
||||
disconnectedCallback() {
|
||||
super.disconnectedCallback();
|
||||
this.resizeObserver.unobserve(this);
|
||||
}
|
||||
|
||||
handleDrag(event: Event) {
|
||||
if (this.disabled) {
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user