From 4d5b583432f75c3478458595754ecf9355f7fa88 Mon Sep 17 00:00:00 2001 From: Emi Matchu Date: Thu, 5 Sep 2024 17:37:16 -0700 Subject: [PATCH] Remove some unnecessary console messages for new outfit viewer For static image layers, this was *always* logging that we failed to send the frame a "pause" message. Which, like, of course! It makes sense to log the notable circumstance where we send a message we *expect* to arrive, but the frame isn't loaded yet. But if there's just no frame, ignore it and don't bother to say so. --- app/assets/javascripts/outfit-viewer.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/assets/javascripts/outfit-viewer.js b/app/assets/javascripts/outfit-viewer.js index 89c1d790..4e034f2d 100644 --- a/app/assets/javascripts/outfit-viewer.js +++ b/app/assets/javascripts/outfit-viewer.js @@ -165,9 +165,12 @@ class OutfitLayer extends HTMLElement { #sendMessageToIframe(message) { // If we have no frame or it hasn't loaded, ignore this message. - if (this.iframe?.contentWindow == null) { + if (this.iframe == null) { + return; + } + if (this.iframe.contentWindow == null) { console.debug( - `Ignoring message, frame not loaded: `, + `Ignoring message, frame not loaded yet: `, this.iframe, message, );