Skip to content
Snippets Groups Projects
Commit 599adebf authored by stvn's avatar stvn
Browse files

Merge PR #23932 revert/iframe-logging

* Commits:
  Revert "Add logging to Learning MFE iframe, temporarily"
parents d24e4fe5 d608b434
No related branches found
No related tags found
No related merge requests found
......@@ -115,13 +115,11 @@ ${HTML(fragment.foot_html())}
% endif
% if is_learning_mfe:
## TODO: Remove console.log statements after production debugging
<script type="text/javascript">
(function() {
// If this view is rendered in an iframe within the learning microfrontend app
// it will report the height of its contents to the parent window when the
// document loads, window resizes, or DOM mutates.
console.log('MFE', 'Start script', document.referrer);
if (window !== window.parent) {
document.body.className += ' view-in-mfe';
var lastHeight = window.offsetHeight;
......@@ -132,13 +130,10 @@ ${HTML(fragment.foot_html())}
// Note: event is actually an Array of MutationRecord objects
// when fired from the MutationObserver
var eventType = event.type || 'mutate';
console.log('MFE', 'Handle resize', eventType);
var newHeight = contentElement.offsetHeight;
var newWidth = contentElement.offsetWidth;
if (eventType !== 'load' && newWidth === lastWidth && newHeight === lastHeight) {
console.log('MFE', 'Ignore resize', newWidth, newHeight, eventType);
return;
}
......@@ -161,7 +156,6 @@ ${HTML(fragment.foot_html())}
// height. This window.scrollTo is an attempt to keep the content at the
// top of the page. See TNL-7094
window.scrollTo(0, 0);
console.log('MFE', 'Did resize', newWidth, newHeight, eventType);
}
// Create an observer instance linked to the callback function
......@@ -172,7 +166,6 @@ ${HTML(fragment.foot_html())}
window.addEventListener('load', dispatchResizeMessage);
window.addEventListener('resize', dispatchResizeMessage);
console.log('MFE', 'Bind events to element', contentElement);
}
}());
</script>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment