build-wp-block #1
@@ -1,18 +1,19 @@
|
||||
'use strict';
|
||||
|
||||
const heightLimit = window.outerHeight * 2;
|
||||
let height = getCurrentHeight();
|
||||
setupResizeListener();
|
||||
|
||||
///
|
||||
|
||||
function setupResizeListener() {
|
||||
const resizeObserver = new ResizeObserver((entries) => setTimeout(handleHeightChange, 100));
|
||||
const resizeObserver = new ResizeObserver(handleHeightChange);
|
||||
resizeObserver.observe(document.body);
|
||||
}
|
||||
|
||||
function handleHeightChange(entries) {
|
||||
const updatedHeight = getCurrentHeight();
|
||||
if (height === updatedHeight) {
|
||||
if (height === updatedHeight || updatedHeight > heightLimit) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user