refactor: event delegation, unified subscription cleanup, centralized listing status helpers
This commit is contained in:
@@ -23,14 +23,16 @@ class PageListing extends HTMLElement {
|
||||
|
||||
connectedCallback() {
|
||||
this.listingId = this.dataset.id
|
||||
this._unsubs = []
|
||||
this.render()
|
||||
this.loadListing()
|
||||
this.unsubscribe = i18n.subscribe(() => this.render())
|
||||
this._unsubs.push(i18n.subscribe(() => this.render()))
|
||||
window.addEventListener('currency-changed', this.handleCurrencyChange)
|
||||
}
|
||||
|
||||
disconnectedCallback() {
|
||||
if (this.unsubscribe) this.unsubscribe()
|
||||
this._unsubs.forEach(fn => fn())
|
||||
this._unsubs = []
|
||||
window.removeEventListener('currency-changed', this.handleCurrencyChange)
|
||||
this.resetMetaTags()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user