fix: fix dispose error

This commit is contained in:
liihuu 2024-10-20 00:24:48 +08:00
parent 8cf36916ce
commit 74902c55a4

View File

@ -136,8 +136,12 @@ export default class Canvas {
}
destroy (): void {
this._resizeObserver.unobserve(this._element)
// eslint-disable-next-line @typescript-eslint/no-deprecated
this._mediaQueryList.removeListener(this._mediaQueryListener)
if (isValid(this._resizeObserver)) {
this._resizeObserver.unobserve(this._element)
}
if (isValid(this._mediaQueryList)) {
// eslint-disable-next-line @typescript-eslint/no-deprecated
this._mediaQueryList.removeListener(this._mediaQueryListener)
}
}
}