remove event listeners prevents memory leaks
This commit is contained in:
parent
cf5cb17d61
commit
bca7fe1d24
|
@ -1,5 +1,5 @@
|
||||||
<script>
|
<script>
|
||||||
import { onMount } from "svelte"
|
import { onMount, onDestroy } from "svelte"
|
||||||
import { store, currentAsset } from "builderStore"
|
import { store, currentAsset } from "builderStore"
|
||||||
import iframeTemplate from "./iframeTemplate"
|
import iframeTemplate from "./iframeTemplate"
|
||||||
import { Screen } from "builderStore/store/screenTemplates/utils/Screen"
|
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) => {
|
const confirmDeleteComponent = (componentId) => {
|
||||||
idToDelete = componentId
|
idToDelete = componentId
|
||||||
confirmDeleteDialog.show()
|
confirmDeleteDialog.show()
|
||||||
|
|
Loading…
Reference in New Issue