This is a simple wrapper around the SizeWatcher. If you are using the JavaScript API, you should use the SizeWatcher directly. The purpose of this widget is to expose the watcher's ability to track size and set relevant CSS properties via the HTML API. See SizeWatcher.trackSize.


To use with auto-widgets (HTML API) (see settings.autoWidgets), the following CSS classes or data attributes are recognized:

  • lisn-track-size class or data-lisn-track-size attribute set on the element that constitutes the widget.

This widget does not support configuration and uses the default SizeWatcher configuration except for resize threshold equal to 0.

This will track the size of this element and set the relevant CSS properties. It will use the default SizeWatcher options and resize threshold of 0.

<div class="lisn-track-size"></div>

Hierarchy (View Summary)

Methods

Constructors

Properties

destroy: () => Promise<void>

Undoes all modifications to the element and returns it to its original state.

You will need to recreate it if you want to enable its functionality again.

disable: () => Promise<void>

Disables the functionality of the widget. What this means is specific to each widget.

enable: () => Promise<void>

Re-enables the functionality of the widget. What this means is specific to each widget.

getElement: () => Element

Returns the element passed to the widget constructor.

isDestroyed: () => boolean

Returns true if the widget is destroyed.

isDisabled: () => boolean

Returns true if the widget is currently disabled.

onDestroy: (handler: WidgetHandler) => void

The given handler will be called when the widget is destroyed.

onDisable: (handler: WidgetHandler) => void

The given handler will be called when the widget is disabled.

onEnable: (handler: WidgetHandler) => void

The given handler will be called when the widget is enabled.

toggleEnable: () => Promise<void>

Re-enables the widget if disabled, otherwise disables it.