PageSwapEvent: PageSwapEvent() constructor

Limited availability

This feature is not Baseline because it does not work in some of the most widely-used browsers.

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
# the-pageswapevent-interface

Browser compatibility

desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
PageSwapEvent() constructor

See also