XResizeObserver is an extension of ResizeObserver

  • observes both border box and content box size changes
  • can skip the initial callback that happens shortly after setting up via observeLater
  • can debounce the callback

Constructors

Properties

disconnect: () => void
observe: (...targets: Element[]) => void

Like ResizeObserver:observe except it accepts multiple targets.

observeLater: (...targets: Element[]) => void

Like observe but it ignores the initial almost immediate callback and only calls the callback on a subsequent resize.

If the target is already being observed, nothing is done.

unobserve: (...targets: Element[]) => void

Like ResizeObserver:unobserve except it accepts multiple targets.