Skip to content

Kepler.gl is a powerful open source geospatial analysis tool for large-scale data sets.

Throttle typings added (#1826)

Mikhail Gorbachev9225e005d7a0
diff --git a/package.json b/package.json
index 7fb0714cb..f5c0a2c5c 100644
--- a/package.json
+++ b/package.json
@@ -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",
diff --git a/src/utils/observe-dimensions.ts b/src/utils/observe-dimensions.ts
index f2adadd6f..e964094b5 100644
--- a/src/utils/observe-dimensions.ts
+++ b/src/utils/observe-dimensions.ts
@@ -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();
@@ -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};
diff --git a/yarn.lock b/yarn.lock
index 7bdc0e658..c7fa91d81 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -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"