remove event listeners prevents memory leaks
This commit is contained in:
parent
1497f3f680
commit
7173be59c6
|
@ -1,5 +1,5 @@
|
|||
<script>
|
||||
import { onMount } from "svelte"
|
||||
import { onMount, onDestroy } from "svelte"
|
||||
import { store, currentAsset } from "builderStore"
|
||||
import iframeTemplate from "./iframeTemplate"
|
||||
import { Screen } from "builderStore/store/screenTemplates/utils/Screen"
|
||||
|
@ -120,6 +120,14 @@
|
|||
})
|
||||
})
|
||||
|
||||
// remove all iframe event listeners on component destroy
|
||||
onDestroy(() => {
|
||||
iframe.contentWindow.removeEventListener("ready")
|
||||
iframe.contentWindow.removeEventListener("error")
|
||||
iframe.contentWindow.removeEventListener("bb-event")
|
||||
iframe.contentWindow.removeEventListener("keydown")
|
||||
})
|
||||
|
||||
const confirmDeleteComponent = (componentId) => {
|
||||
idToDelete = componentId
|
||||
confirmDeleteDialog.show()
|
||||
|
|
Loading…
Reference in New Issue