From 714ad1403bea8f8aee3a4d4267e5ef53576a34fd Mon Sep 17 00:00:00 2001 From: Alex Lende Date: Tue, 3 Dec 2024 09:54:17 -0600 Subject: [PATCH] Add types and details in JSDoc comments --- .../src/components/iframe/use-scale-canvas.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/packages/block-editor/src/components/iframe/use-scale-canvas.js b/packages/block-editor/src/components/iframe/use-scale-canvas.js index 7c4fd767291da1..0e718e7ffa7cb6 100644 --- a/packages/block-editor/src/components/iframe/use-scale-canvas.js +++ b/packages/block-editor/src/components/iframe/use-scale-canvas.js @@ -120,8 +120,20 @@ function getAnimationKeyframes( transitionFrom, transitionTo ) { ]; } +/** + * @typedef {Object} ObservedSize + * @property {number|null} width The width of the observed element. + * @property {number|null} height The height of the observed element. + */ +/** @type {ObservedSize} */ const NULL_SIZE = { width: null, height: null }; +/** + * Get the size of the observed element. + * + * @param {ResizeObserverEntry[]} entries Array of the new dimensions of the element after each change. + * @return {ObservedSize} Latest width and height of the observed element. + */ function extractSize( entries ) { const contentBlockSize = entries.at( -1 ).contentBoxSize[ 0 ]; return {