From 64570154063171ef09965979b8fe995425ea1935 Mon Sep 17 00:00:00 2001 From: Ginger Wong Date: Mon, 24 Aug 2020 12:34:36 -0700 Subject: [PATCH] cleanup --- webroot/js/app.js | 1 + webroot/js/components/chat/chat.js | 6 ++++++ webroot/js/utils/helpers.js | 15 --------------- 3 files changed, 7 insertions(+), 15 deletions(-) diff --git a/webroot/js/app.js b/webroot/js/app.js index 56ff53b86..29e355f28 100644 --- a/webroot/js/app.js +++ b/webroot/js/app.js @@ -114,6 +114,7 @@ export default class App extends Component { clearInterval(this.statusTimer); clearTimeout(this.disableChatTimer); clearInterval(this.streamDurationTimer); + window.removeEventListener('resize', this.handleWindowResize); } // fetch /config data diff --git a/webroot/js/components/chat/chat.js b/webroot/js/components/chat/chat.js index 2953de1b3..e6a24de32 100644 --- a/webroot/js/components/chat/chat.js +++ b/webroot/js/components/chat/chat.js @@ -56,6 +56,12 @@ export default class Chat extends Component { } } + componentWillUnmount() { + if (hasTouchScreen()) { + window.removeEventListener("orientationchange", setVHvar); + } + } + setupWebSocketCallbacks() { this.websocket = this.props.websocket; if (this.websocket) { diff --git a/webroot/js/utils/helpers.js b/webroot/js/utils/helpers.js index 1f913e8f9..06aefecb8 100644 --- a/webroot/js/utils/helpers.js +++ b/webroot/js/utils/helpers.js @@ -142,18 +142,3 @@ export function debounce(fn, time) { timeout = setTimeout(functionCall, time); } } - -/* -const debouncedHandleResize = debounce(function handleResize() { - setDimensions({ - height: window.innerHeight, - width: window.innerWidth - }) -}, 1000) -window.addEventListener('resize', debouncedHandleResize) -window.addEventListener('keyup', debounce((e) => { - console.log(e); -}, 1000)); - -*/ -