From 378e2753722a44a6e42e1ff2ee8c5cd9efce1a04 Mon Sep 17 00:00:00 2001 From: LoveEevee Date: Thu, 25 Oct 2018 18:50:10 +0300 Subject: [PATCH] Fix view not cleaning some variables --- public/src/js/view.js | 26 +++++++++++++++----------- public/src/js/viewassets.js | 7 +++++++ 2 files changed, 22 insertions(+), 11 deletions(-) diff --git a/public/src/js/view.js b/public/src/js/view.js index fc216ed..37a1906 100644 --- a/public/src/js/view.js +++ b/public/src/js/view.js @@ -1286,22 +1286,26 @@ return this.controller.getElapsedTime() } clean(){ + this.draw.clean() + this.assets.clean() + this.titleCache.clean() this.comboCache.clean() if(this.multiplayer !== 2){ pageEvents.remove(window, "resize") + if(this.touchEnabled){ + pageEvents.remove(this.canvas, "touchstart") + pageEvents.remove(this.touchFullBtn, "touchend") + pageEvents.remove(this.touchPauseBtn, "touchend") + this.gameDiv.classList.remove("touch-visible") + document.getElementById("version").classList.remove("version-hide") + delete this.touchDrumDiv + delete this.touchDrumImg + delete this.touchFullBtn + delete this.touchPauseBtn + } } - if(this.touchEnabled){ - pageEvents.remove(this.canvas, "touchstart") - pageEvents.remove(this.touchFullBtn, "touchend") - pageEvents.remove(this.touchPauseBtn, "touchend") - this.gameDiv.classList.remove("touch-visible") - document.getElementById("version").classList.remove("version-hide") - delete this.touchDrumDiv - delete this.touchDrumImg - delete this.touchFullBtn - delete this.touchPauseBtn - } + pageEvents.mouseRemove(this) delete this.pauseMenu delete this.cursor delete this.gameDiv diff --git a/public/src/js/viewassets.js b/public/src/js/viewassets.js index 14b26bd..719cc18 100644 --- a/public/src/js/viewassets.js +++ b/public/src/js/viewassets.js @@ -131,4 +131,11 @@ class ViewAssets{ asset.changeBeatInterval(beatMS, initial) }) } + clean(){ + delete this.ctx + delete this.don + delete this.fire + delete this.fireworks + delete this.allAssets + } }