Skip to content

Commit

Permalink
fix: remive resize handler on disconnection
Browse files Browse the repository at this point in the history
  • Loading branch information
bsorrentino committed Jul 27, 2024
1 parent cd4f307 commit 5b76da0
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions server-jetty/src/main/js/src/lg4j-graph.js
Original file line number Diff line number Diff line change
Expand Up @@ -182,20 +182,21 @@ export class LG4jMermaid extends HTMLElement {
this.#renderDiagram()
}

#resizeHandler = () => this.#renderDiagram()

connectedCallback() {

this.addEventListener('graph', this.#onContent)
this.addEventListener('graph-active', this.#onActive)
window.addEventListener('resize', () => {
this.#renderDiagram()
})
window.addEventListener('resize', this.#resizeHandler )

}

disconnectedCallback() {

this.removeEventListener('graph', this.#onContent)
this.removeEventListener('graph-active', this.#onActive)
window.removeEventListener('resize', this.#resizeHandler )
}

// @deprecated
Expand Down

0 comments on commit 5b76da0

Please sign in to comment.