PageSwapEvent: PageSwapEvent() constructor

Experimental: This is an experimental technology
Check the Browser compatibility table carefully before using this in production.

The PageSwapEvent() constructor creates a new PageSwapEvent object instance.

Syntax

js
new PageSwapEvent(type, init)

Parameters

type

A string representing the type of event. In the case of PageSwapEvent this is always pageswap.

init

An object containing the following properties:

activation

A NavigationActivation object representing the navigation type and current and destination document history entries. Defaults to null if the associated navigation is a cross-origin navigation.

viewTransition

A ViewTransition object representing the active view transition for the related navigation. Defaults to null if there is no active view transition.

Examples

A developer would not use this constructor manually. A new PageSwapEvent object is constructed when a handler is invoked as a result of the pageswap event firing.

Specifications

Specification
HTML Standard
# the-pageswapevent-interface

Browser compatibility

BCD tables only load in the browser

See also