@studiometa/js-toolkit 2.0.0-rc.2 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Base/index.cjs +54 -18
- package/Base/index.d.ts +47 -26
- package/Base/index.js +54 -18
- package/Base/managers/AbstractManager.cjs +56 -0
- package/Base/managers/AbstractManager.d.ts +44 -0
- package/Base/managers/AbstractManager.js +35 -0
- package/Base/managers/ChildrenManager.cjs +79 -100
- package/Base/managers/ChildrenManager.d.ts +8 -83
- package/Base/managers/ChildrenManager.js +76 -100
- package/Base/managers/EventsManager.cjs +75 -99
- package/Base/managers/EventsManager.d.ts +37 -113
- package/Base/managers/EventsManager.js +75 -99
- package/Base/managers/OptionsManager.cjs +65 -79
- package/Base/managers/OptionsManager.d.ts +41 -80
- package/Base/managers/OptionsManager.js +66 -80
- package/Base/managers/RefsManager.cjs +44 -68
- package/Base/managers/RefsManager.d.ts +12 -66
- package/Base/managers/RefsManager.js +41 -69
- package/Base/managers/ResponsiveOptionsManager.cjs +62 -0
- package/Base/managers/ResponsiveOptionsManager.d.ts +26 -0
- package/Base/managers/ResponsiveOptionsManager.js +37 -0
- package/Base/managers/ServicesManager.cjs +7 -10
- package/Base/managers/ServicesManager.d.ts +16 -19
- package/Base/managers/ServicesManager.js +7 -10
- package/Base/utils.d.ts +4 -4
- package/decorators/index.cjs +2 -0
- package/decorators/index.d.ts +1 -0
- package/decorators/index.js +6 -4
- package/decorators/withBreakpointManager.cjs +0 -1
- package/decorators/withBreakpointManager.d.ts +2 -2
- package/decorators/withBreakpointManager.js +0 -1
- package/decorators/withBreakpointObserver.cjs +1 -2
- package/decorators/withBreakpointObserver.d.ts +1 -1
- package/decorators/withBreakpointObserver.js +1 -2
- package/decorators/withDrag.d.ts +1 -1
- package/decorators/withExtraConfig.d.ts +1 -1
- package/decorators/withFreezedOptions.cjs +12 -3
- package/decorators/withFreezedOptions.d.ts +1 -1
- package/decorators/withFreezedOptions.js +13 -3
- package/decorators/withIntersectionObserver.cjs +0 -1
- package/decorators/withIntersectionObserver.d.ts +1 -1
- package/decorators/withIntersectionObserver.js +0 -1
- package/decorators/withMountWhenInView.cjs +0 -1
- package/decorators/withMountWhenInView.d.ts +1 -1
- package/decorators/withMountWhenInView.js +0 -1
- package/decorators/withResponsiveOptions.cjs +39 -0
- package/decorators/withResponsiveOptions.d.ts +8 -0
- package/decorators/withResponsiveOptions.js +14 -0
- package/decorators/withScrolledInView.cjs +58 -23
- package/decorators/withScrolledInView.d.ts +5 -3
- package/decorators/withScrolledInView.js +59 -24
- package/helpers/createApp.d.ts +3 -26
- package/helpers/getInstanceFromElement.cjs +32 -0
- package/helpers/getInstanceFromElement.d.ts +14 -0
- package/helpers/getInstanceFromElement.js +10 -0
- package/helpers/importOnInteraction.d.ts +3 -5
- package/helpers/importWhenIdle.d.ts +3 -5
- package/helpers/importWhenVisible.d.ts +4 -6
- package/helpers/index.cjs +2 -0
- package/helpers/index.d.ts +1 -0
- package/helpers/index.js +8 -6
- package/helpers/utils.d.ts +3 -4
- package/package.json +2 -1
- package/services/Service.d.ts +9 -9
- package/services/drag.cjs +0 -1
- package/services/drag.d.ts +3 -3
- package/services/drag.js +0 -1
- package/services/key.d.ts +1 -1
- package/services/load.d.ts +1 -1
- package/services/pointer.d.ts +1 -1
- package/services/raf.d.ts +1 -1
- package/services/resize.cjs +2 -2
- package/services/resize.d.ts +1 -1
- package/services/resize.js +2 -2
- package/services/scroll.cjs +3 -1
- package/services/scroll.d.ts +1 -1
- package/services/scroll.js +3 -1
- package/utils/collide/boundingRectToCircle.d.ts +5 -5
- package/utils/collide/collideCircleCircle.d.ts +4 -4
- package/utils/collide/collideCircleRect.d.ts +8 -8
- package/utils/collide/collidePointCircle.d.ts +6 -6
- package/utils/collide/collidePointRect.d.ts +7 -7
- package/utils/collide/collideRectRect.d.ts +5 -5
- package/utils/css/animate.cjs +190 -0
- package/utils/css/animate.d.ts +57 -0
- package/utils/css/animate.js +165 -0
- package/utils/css/classes.cjs +3 -3
- package/utils/css/classes.d.ts +10 -10
- package/utils/css/classes.js +3 -3
- package/utils/css/getOffsetSizes.cjs +47 -0
- package/utils/css/getOffsetSizes.d.ts +15 -0
- package/utils/css/getOffsetSizes.js +25 -0
- package/utils/css/index.cjs +6 -0
- package/utils/css/index.d.ts +3 -0
- package/utils/css/index.js +9 -4
- package/utils/css/matrix.d.ts +14 -15
- package/utils/css/styles.d.ts +2 -2
- package/utils/css/transform.cjs +91 -0
- package/utils/css/transform.d.ts +43 -0
- package/utils/css/transform.js +66 -0
- package/utils/css/transition.cjs +2 -0
- package/utils/css/transition.d.ts +2 -2
- package/utils/css/transition.js +2 -0
- package/utils/debounce.d.ts +4 -4
- package/utils/focusTrap.cjs +1 -1
- package/utils/focusTrap.d.ts +1 -0
- package/utils/focusTrap.js +1 -1
- package/utils/history.d.ts +13 -11
- package/utils/index.cjs +4 -0
- package/utils/index.d.ts +2 -0
- package/utils/index.js +4 -0
- package/utils/isDefined.cjs +28 -0
- package/utils/isDefined.d.ts +7 -0
- package/utils/isDefined.js +6 -0
- package/utils/isFunction.cjs +28 -0
- package/utils/isFunction.d.ts +7 -0
- package/utils/isFunction.js +6 -0
- package/utils/math/clamp.d.ts +1 -1
- package/utils/math/clamp01.d.ts +1 -1
- package/utils/math/damp.d.ts +6 -6
- package/utils/math/ease.d.ts +7 -7
- package/utils/math/index.cjs +2 -0
- package/utils/math/index.d.ts +1 -0
- package/utils/math/index.js +2 -0
- package/utils/math/inertiaFinalValue.d.ts +5 -5
- package/utils/math/lerp.d.ts +4 -4
- package/utils/math/map.d.ts +6 -6
- package/utils/math/round.d.ts +4 -4
- package/utils/memoize.d.ts +1 -1
- package/utils/nextFrame.d.ts +3 -4
- package/utils/nextMicrotask.d.ts +1 -1
- package/utils/nextTick.d.ts +1 -1
- package/utils/object/autoBind.d.ts +3 -3
- package/utils/object/getAllProperties.d.ts +3 -3
- package/utils/object/isObject.d.ts +1 -1
- package/utils/scrollTo.cjs +1 -1
- package/utils/scrollTo.d.ts +1 -1
- package/utils/scrollTo.js +1 -1
- package/utils/string/withLeadingCharacters.d.ts +3 -2
- package/utils/string/withLeadingSlash.d.ts +1 -1
- package/utils/string/withTrailingCharacters.d.ts +3 -2
- package/utils/string/withTrailingSlash.d.ts +1 -1
- package/utils/string/withoutLeadingCharacters.d.ts +3 -2
- package/utils/string/withoutLeadingCharactersRecursive.d.ts +3 -2
- package/utils/string/withoutLeadingSlash.d.ts +1 -1
- package/utils/string/withoutTrailingCharacters.d.ts +3 -2
- package/utils/string/withoutTrailingCharactersRecursive.d.ts +3 -2
- package/utils/string/withoutTrailingSlash.d.ts +1 -1
- package/utils/throttle.cjs +1 -1
- package/utils/throttle.d.ts +3 -3
- package/utils/throttle.js +1 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Get the final damped value for a given factor.
|
|
3
3
|
*
|
|
4
|
-
* @param
|
|
5
|
-
* @param
|
|
6
|
-
* @param
|
|
7
|
-
* @
|
|
4
|
+
* @param {number} initialValue The final value.
|
|
5
|
+
* @param {number} initialDelta The current value.
|
|
6
|
+
* @param {number} [dampFactor=0.85] The speed to reach the target value.
|
|
7
|
+
* @returns {number} The next value.
|
|
8
8
|
*/
|
|
9
|
-
export default function inertiaFinalValue(initialValue: number, initialDelta: number, dampFactor?: number
|
|
9
|
+
export default function inertiaFinalValue(initialValue: number, initialDelta: number, dampFactor?: number): number;
|
package/utils/math/lerp.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Interpolate the ratio between a given interval.
|
|
3
3
|
*
|
|
4
|
-
* @param {
|
|
5
|
-
* @param {
|
|
6
|
-
* @param {
|
|
7
|
-
* @
|
|
4
|
+
* @param {number} min The interval minimum value.
|
|
5
|
+
* @param {number} max The inverval maximum value.
|
|
6
|
+
* @param {number} ratio The ratio to get.
|
|
7
|
+
* @returns {number} The value between min and max corresponding to ratio.
|
|
8
8
|
*/
|
|
9
9
|
export default function lerp(min: number, max: number, ratio: number): number;
|
package/utils/math/map.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Maps the value from one range of [inputMin..inputMax] to another range of [outputMin..outputMax].
|
|
3
3
|
*
|
|
4
|
-
* @param {
|
|
5
|
-
* @param {
|
|
6
|
-
* @param {
|
|
7
|
-
* @param {
|
|
8
|
-
* @param {
|
|
9
|
-
* @
|
|
4
|
+
* @param {number} value The value to map.
|
|
5
|
+
* @param {number} inputMin The input's minimum value.
|
|
6
|
+
* @param {number} inputMax The input's maximum value.
|
|
7
|
+
* @param {number} outputMin The output's minimum value.
|
|
8
|
+
* @param {number} outputMax The output's maximum value.
|
|
9
|
+
* @returns {number} The input value mapped to the output range.
|
|
10
10
|
*/
|
|
11
11
|
export default function map(value: number, inputMin: number, inputMax: number, outputMin: number, outputMax: number): number;
|
package/utils/math/round.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Round a value with a given number of decimals.
|
|
3
3
|
*
|
|
4
|
-
* @param
|
|
5
|
-
* @param
|
|
6
|
-
* @
|
|
4
|
+
* @param {number} value The number to round.
|
|
5
|
+
* @param {number} [decimals=0] The number of decimals to keep.
|
|
6
|
+
* @returns {number} A rounded number to the given decimals length.
|
|
7
7
|
*/
|
|
8
|
-
export default function round(value: number, decimals?: number
|
|
8
|
+
export default function round(value: number, decimals?: number): number;
|
package/utils/memoize.d.ts
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* @template {(...args:any) => any} T
|
|
16
16
|
* @param {T} fn
|
|
17
17
|
* @param {MemorizeOptions} options
|
|
18
|
-
* @
|
|
18
|
+
* @returns {(...args:Parameters<T>) => ReturnType<T>}
|
|
19
19
|
*/
|
|
20
20
|
export default function memoize<T extends (...args: any) => any>(fn: T, { maxAge, cacheKey, cache }?: MemorizeOptions): (...args: Parameters<T>) => ReturnType<T>;
|
|
21
21
|
export type MemorizeCache = {
|
package/utils/nextFrame.d.ts
CHANGED
|
@@ -1,22 +1,21 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* RequestAnimation frame polyfill.
|
|
3
3
|
* @see https://github.com/vuejs/vue/blob/ec78fc8b6d03e59da669be1adf4b4b5abf670a34/dist/vue.runtime.esm.js#L7355
|
|
4
|
-
* @
|
|
4
|
+
* @returns {(handler: Function) => number}
|
|
5
5
|
*/
|
|
6
6
|
export function getRaf(): (handler: Function) => number;
|
|
7
7
|
/**
|
|
8
8
|
* Get a function to cancel the method returned by `getRaf()`.
|
|
9
9
|
*
|
|
10
|
-
* @
|
|
10
|
+
* @returns {(id:number) => void}
|
|
11
11
|
*/
|
|
12
12
|
export function getCancelRaf(): (id: number) => void;
|
|
13
13
|
/**
|
|
14
14
|
* Wait for the next frame to execute a function.
|
|
15
15
|
*
|
|
16
16
|
* @template {() => any} T
|
|
17
|
-
* @param {T
|
|
17
|
+
* @param {T} [fn] The callback function to execute.
|
|
18
18
|
* @returns {Promise<T extends Function ? ReturnType<T> : undefined>} A Promise resolving when the next frame is reached.
|
|
19
|
-
*
|
|
20
19
|
* @example
|
|
21
20
|
* ```js
|
|
22
21
|
* nextFrame(() => console.log('hello world'));
|
package/utils/nextMicrotask.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Wait for the next microtask.
|
|
3
3
|
*
|
|
4
4
|
* @template {() => any} T
|
|
5
|
-
* @param {T
|
|
5
|
+
* @param {T} [fn]
|
|
6
6
|
* @returns {Promise<T extends Function ? ReturnType<T> : undefined>}
|
|
7
7
|
*/
|
|
8
8
|
export default function nextMicrotask<T extends () => any>(fn?: T): Promise<T extends Function ? ReturnType<T> : undefined>;
|
package/utils/nextTick.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Wait for the next tick.
|
|
3
3
|
*
|
|
4
4
|
* @template {() => any} T
|
|
5
|
-
* @param {T
|
|
5
|
+
* @param {T} [fn]
|
|
6
6
|
* @returns {Promise<T extends Function ? ReturnType<T> : undefined>}
|
|
7
7
|
*/
|
|
8
8
|
export default function nextTick<T extends () => any>(fn?: T): Promise<T extends Function ? ReturnType<T> : undefined>;
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
*
|
|
4
4
|
* @param {Object} instance The instance.
|
|
5
5
|
* @param {Object} options Define specific methods to include or exlude.
|
|
6
|
-
* @param {Array<
|
|
7
|
-
* @param {Array<
|
|
8
|
-
* @
|
|
6
|
+
* @param {Array<string | RegExp>} [options.include] Methods to include.
|
|
7
|
+
* @param {Array<string | RegExp>} [options.exclude] Methods to exclude.
|
|
8
|
+
* @returns {Object} The instance.
|
|
9
9
|
*/
|
|
10
10
|
export default function autoBind(instance: any, options: {
|
|
11
11
|
include?: Array<string | RegExp>;
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
*
|
|
4
4
|
* @param {Object} object
|
|
5
5
|
* The object to get the propeties from.
|
|
6
|
-
* @param {Array
|
|
6
|
+
* @param {Array} [props=[]]
|
|
7
7
|
* The already existing properties.
|
|
8
8
|
* @param {(name:string, proto:any) => boolean} testFn
|
|
9
|
-
* @
|
|
9
|
+
* @returns {Array<[string, Object]>} An array of properties and the prototype they belong to.
|
|
10
10
|
*/
|
|
11
|
-
export default function getAllProperties(object: any, props?: any[]
|
|
11
|
+
export default function getAllProperties(object: any, props?: any[], testFn?: (name: string, proto: any) => boolean): Array<[string, any]>;
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
* Test if the given value is an object.
|
|
3
3
|
*
|
|
4
4
|
* @param {*} value The value to test.
|
|
5
|
-
* @
|
|
5
|
+
* @returns {boolean} Whether or not the value is an object.
|
|
6
6
|
*/
|
|
7
7
|
export default function isObject(value: any): boolean;
|
package/utils/scrollTo.cjs
CHANGED
|
@@ -39,7 +39,7 @@ function scrollTo(selectorElement, { offset = 0, dampFactor = 0.2 } = {}) {
|
|
|
39
39
|
const sizes = targetElement.getBoundingClientRect();
|
|
40
40
|
const scrollMargin = getComputedStyle(targetElement).scrollMarginTop || "0";
|
|
41
41
|
const max = document.documentElement.scrollHeight - window.innerHeight;
|
|
42
|
-
let scrollTarget = sizes.top + window.pageYOffset - parseInt(scrollMargin, 10) - offset;
|
|
42
|
+
let scrollTarget = sizes.top + window.pageYOffset - Number.parseInt(scrollMargin, 10) - offset;
|
|
43
43
|
if (scrollTarget > max) {
|
|
44
44
|
scrollTarget = max;
|
|
45
45
|
}
|
package/utils/scrollTo.d.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* @param {HTMLElement|string} selectorElement The target element.
|
|
5
5
|
* @param {{ offset?: number, dampFactor?: number }} [options] Options for the scroll.
|
|
6
|
-
* @
|
|
6
|
+
* @returns {Promise<number>} A promising resolving with the target scroll position.
|
|
7
7
|
*/
|
|
8
8
|
export default function scrollTo(selectorElement: HTMLElement | string, { offset, dampFactor }?: {
|
|
9
9
|
offset?: number;
|
package/utils/scrollTo.js
CHANGED
|
@@ -12,7 +12,7 @@ function scrollTo(selectorElement, { offset = 0, dampFactor = 0.2 } = {}) {
|
|
|
12
12
|
const sizes = targetElement.getBoundingClientRect();
|
|
13
13
|
const scrollMargin = getComputedStyle(targetElement).scrollMarginTop || "0";
|
|
14
14
|
const max = document.documentElement.scrollHeight - window.innerHeight;
|
|
15
|
-
let scrollTarget = sizes.top + window.pageYOffset - parseInt(scrollMargin, 10) - offset;
|
|
15
|
+
let scrollTarget = sizes.top + window.pageYOffset - Number.parseInt(scrollMargin, 10) - offset;
|
|
16
16
|
if (scrollTarget > max) {
|
|
17
17
|
scrollTarget = max;
|
|
18
18
|
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Add the given characters to the start of the given string.
|
|
3
3
|
*
|
|
4
|
-
* @param
|
|
5
|
-
* @param
|
|
4
|
+
* @param {string} string The string to modify.
|
|
5
|
+
* @param {string} characters The characters to add to the start.
|
|
6
|
+
* @returns {string}
|
|
6
7
|
*/
|
|
7
8
|
export default function withLeadingCharacters(string: string, characters: string): string;
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
* Add a leading slash to a string.
|
|
3
3
|
*
|
|
4
4
|
* @param {string} string The string to modify.
|
|
5
|
-
* @
|
|
5
|
+
* @returns {string} The string with a leading slash.
|
|
6
6
|
*/
|
|
7
7
|
export default function withLeadingSlash(string: string): string;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Add the given characters to the end of the given string.
|
|
3
3
|
*
|
|
4
|
-
* @param
|
|
5
|
-
* @param
|
|
4
|
+
* @param {string} string The string to modify.
|
|
5
|
+
* @param {string} characters The characters to add to the end.
|
|
6
|
+
* @returns {string}
|
|
6
7
|
*/
|
|
7
8
|
export default function withTrailingCharacters(string: string, characters: string): string;
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
* Add a trailing slash to a string.
|
|
3
3
|
*
|
|
4
4
|
* @param {string} string The string to modify.
|
|
5
|
-
* @
|
|
5
|
+
* @returns {string} The string with a trailing slash.
|
|
6
6
|
*/
|
|
7
7
|
export default function withTrailingSlash(string: string): string;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Remove the given characters from the start of the given string.
|
|
3
3
|
*
|
|
4
|
-
* @param
|
|
5
|
-
* @param
|
|
4
|
+
* @param {string} string The string to modify.
|
|
5
|
+
* @param {string} characters The characters to remove from the start.
|
|
6
|
+
* @returns {string}
|
|
6
7
|
*/
|
|
7
8
|
export default function withoutLeadingCharacters(string: string, characters: string): string;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Remove the given characters to the start of the given string recursively.
|
|
3
3
|
*
|
|
4
|
-
* @param
|
|
5
|
-
* @param
|
|
4
|
+
* @param {string} string The string to modify.
|
|
5
|
+
* @param {string} characters The characters to add to the start.
|
|
6
|
+
* @returns {string}
|
|
6
7
|
*/
|
|
7
8
|
export default function withoutLeadingCharactersRecursive(string: string, characters: string): string;
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
* Remove the leading slash from a string.
|
|
3
3
|
*
|
|
4
4
|
* @param {string} string The string to modify.
|
|
5
|
-
* @
|
|
5
|
+
* @returns {string} The string without leading slash.
|
|
6
6
|
*/
|
|
7
7
|
export default function withoutLeadingSlash(string: string): string;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Remove the given characters from the end of the given string.
|
|
3
3
|
*
|
|
4
|
-
* @param
|
|
5
|
-
* @param
|
|
4
|
+
* @param {string} string The string to modify.
|
|
5
|
+
* @param {string} characters The characters to remove from the end.
|
|
6
|
+
* @returns {string}
|
|
6
7
|
*/
|
|
7
8
|
export default function withoutTrailingCharacters(string: string, characters: string): string;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Remove the given characters to the start of the given string recursively.
|
|
3
3
|
*
|
|
4
|
-
* @param
|
|
5
|
-
* @param
|
|
4
|
+
* @param {string} string The string to modify.
|
|
5
|
+
* @param {string} characters The characters to add to the start.
|
|
6
|
+
* @returns {string}
|
|
6
7
|
*/
|
|
7
8
|
export default function withoutTrailingCharactersRecursive(string: string, characters: string): string;
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
* Remove the trailing slash from a string.
|
|
3
3
|
*
|
|
4
4
|
* @param {string} string The string to modify.
|
|
5
|
-
* @
|
|
5
|
+
* @returns {string} The string without trailing slash.
|
|
6
6
|
*/
|
|
7
7
|
export default function withoutTrailingSlash(string: string): string;
|
package/utils/throttle.cjs
CHANGED
|
@@ -25,7 +25,7 @@ module.exports = __toCommonJS(throttle_exports);
|
|
|
25
25
|
function throttle(fn, delay = 16) {
|
|
26
26
|
let lastCall = 0;
|
|
27
27
|
return function throttled(...args) {
|
|
28
|
-
const now =
|
|
28
|
+
const now = Date.now();
|
|
29
29
|
if (now - lastCall < delay) {
|
|
30
30
|
return false;
|
|
31
31
|
}
|
package/utils/throttle.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Simple throttling helper that limits a function to only run once every {delay}ms.
|
|
3
3
|
*
|
|
4
4
|
* @param {Function} fn The function to throttle
|
|
5
|
-
* @param {
|
|
6
|
-
* @
|
|
5
|
+
* @param {number} [delay] The delay in ms
|
|
6
|
+
* @returns {Function} The throttled function.
|
|
7
7
|
*/
|
|
8
|
-
export default function throttle(fn: Function, delay?: number
|
|
8
|
+
export default function throttle(fn: Function, delay?: number): Function;
|