Back to Content

ContentVisibilityAutoStateChangeEvent: ContentVisibilityAutoStateChangeEvent() constructor

files/en-us/web/api/contentvisibilityautostatechangeevent/contentvisibilityautostatechangeevent/index.md

latest1.4 KB
Original Source

{{APIRef("CSS Containment")}}

The ContentVisibilityAutoStateChangeEvent() constructor creates a new {{domxref("ContentVisibilityAutoStateChangeEvent")}} object instance.

Syntax

js-nolint
new ContentVisibilityAutoStateChangeEvent(type, options)

Parameters

  • type
    • : A string representing the type of event. In the case of ContentVisibilityAutoStateChangeEvent this is always event.
  • options {{optional_inline}}
    • : An object that contains the following properties:

Examples

A developer would not use this constructor manually. A new ContentVisibilityAutoStateChangeEvent object is constructed when a handler is invoked as a result of the {{domxref("element/contentvisibilityautostatechange_event", "contentvisibilityautostatechange")}} event firing.

js
canvasElem.addEventListener("contentvisibilityautostatechange", (event) => {
  // …
});

Specifications

{{Specifications}}

Browser compatibility

{{Compat}}

See also

  • The {{domxref("element/contentvisibilityautostatechange_event", "contentvisibilityautostatechange")}} event
  • CSS Containment
  • The {{cssxref("content-visibility")}} property
  • The {{cssxref("contain")}} property