• Provides an action to monitor the given HTMLElement node with ResizeObserver via ResizeObserverManager posting width / height changes to the ResizeObserverData.ResizeTarget in various ways depending on the shape of the target. The target can be one of the following and the precedence order is listed from top to bottom:

    • has a resizeObserved function as attribute; offset then content width / height are passed as parameters.
    • has a setContentBounds function as attribute; content width / height are passed as parameters.
    • has a setDimension function as attribute; offset width / height are passed as parameters.
    • target is an object; offset and content width / height attributes directly set on target.
    • target is a function; the function invoked with offset then content width / height parameters.
    • has a writable store resizeObserved as an attribute; updated with offset & content width / height.
    • has an object 'stores' that has a writable store resizeObserved as an attribute; updated with offset & content width / height.

    Note: Svelte currently uses an archaic IFrame based workaround to monitor offset / client width & height changes. A more up to date way to do this is with ResizeObserver. To track when Svelte receives ResizeObserver support monitor this issue: https://github.com/sveltejs/svelte/issues/4233

    Can-I-Use: https://caniuse.com/resizeobserver

    Parameters

    • node: HTMLElement

      The node associated with the action.

    • target: ResizeTarget

      A ResizeObserverManager target to update with observed width & height changes.

    Returns ActionReturn<ResizeTarget>

    The action lifecycle methods.