Skip to content

Commit

Permalink
Throttle typings added (#1826)
Browse files Browse the repository at this point in the history
Signed-off-by: Mikhail Gorbachev <mikhail.gorbachev@actionengine.com>
  • Loading branch information
Mikhail Gorbachev committed May 23, 2022
1 parent f0671f0 commit 9225e00
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
1 change: 1 addition & 0 deletions package.json
Expand Up @@ -115,6 +115,7 @@
"@types/lodash.get": "^4.4.6",
"@types/lodash.isequal": "^4.5.5",
"@types/lodash.pick": "^4.4.6",
"@types/lodash.throttle": "^4.1.7",
"@types/lodash.uniq": "^4.5.7",
"@types/lodash.uniqby": "^4.7.7",
"@types/lodash.xor": "^4.5.7",
Expand Down
4 changes: 2 additions & 2 deletions src/utils/observe-dimensions.ts
Expand Up @@ -59,7 +59,7 @@ function getObserverRegistry() {

export function observeDimensions(
target: Element,
handleResize: (size: Dimensions) => void,
handleResize: (size: Dimensions | null) => void,
throttleDelay = DEFAULT_THROTTLE_DELAY
) {
const registry = getObserverRegistry();
Expand All @@ -72,7 +72,7 @@ export function unobserveDimensions(target: Element) {
registry.unsubscribe(target);
}

function getSize(node, entry) {
function getSize(node, entry): Dimensions | null {
if (entry.contentRect) {
const {width, height} = entry.contentRect;
return {width, height};
Expand Down
7 changes: 7 additions & 0 deletions yarn.lock
Expand Up @@ -3324,6 +3324,13 @@
dependencies:
"@types/lodash" "*"

"@types/lodash.throttle@^4.1.7":
version "4.1.7"
resolved "https://registry.yarnpkg.com/@types/lodash.throttle/-/lodash.throttle-4.1.7.tgz#4ef379eb4f778068022310ef166625f420b6ba58"
integrity sha512-znwGDpjCHQ4FpLLx19w4OXDqq8+OvREa05H89obtSyXyOFKL3dDjCslsmfBz0T2FU8dmf5Wx1QvogbINiGIu9g==
dependencies:
"@types/lodash" "*"

"@types/lodash.uniq@^4.5.7":
version "4.5.7"
resolved "https://registry.yarnpkg.com/@types/lodash.uniq/-/lodash.uniq-4.5.7.tgz#0773960ec0148b29e6a54821a65b878a0ebb5c1a"
Expand Down

0 comments on commit 9225e00

Please sign in to comment.