interface OnResizeOptions {
    box?: Box;
    debounceWindow?: number;
    dimension?: Dimension;
    skipInitial?: boolean;
    target?: SizeTarget;
    threshold?: number;
}

Properties

box?: Box

Specifies whether to listen for changes in content box size or border box size.

If not given, then it listens for changes in either.

undefined
debounceWindow?: number

If non-0, the handler will be "debounced" so it's called at most debounceWindow milliseconds.

dimension?: Dimension

Specifies whether to listen for changes in width or height.

If not given, then it listens for changes in either.

undefined
skipInitial?: boolean

Do not call the handler until there's a future resize of the element.

By default we call the handler (almost) immediately with the current size data for the target.

false
target?: SizeTarget

If it is not given, or is null or window, then it will track the size of the viewport (akin to clientHeight on documentElement).

If it is document, then it will use document.documentElement.

Other values of target must be an Element and are taken literally.

undefined
threshold?: number

If non-0, the handler will only be called when the target's size in the observed OnResizeOptions.dimension and OnResizeOptions.box type has changed at least threshold pixels since the last time the handler was called.

Special case when threshold is 0 and at least one of OnResizeOptions.dimension or OnResizeOptions.box is given: if there's a resize event but the size in the observed dimensions/box types has not changed, the callback is not called.