diff --git a/src/__tests__/events.js b/src/__tests__/events.js index 20d01b0d..f96c0da1 100644 --- a/src/__tests__/events.js +++ b/src/__tests__/events.js @@ -77,8 +77,8 @@ const eventTypes = [ elementType: 'img', }, { - type: '', - events: ['offline', 'online'], + type: 'Window', + events: ['offline', 'online', 'pageHide', 'pageShow'], elementType: 'window', }, { diff --git a/src/event-map.js b/src/event-map.js index 30e4f9d0..08676759 100644 --- a/src/event-map.js +++ b/src/event-map.js @@ -372,6 +372,14 @@ export const eventMap = { EventType: 'Event', defaultInit: {bubbles: false, cancelable: false}, }, + pageHide: { + EventType: 'PageTransitionEvent', + defaultInit: {bubbles: true, cancelable: true}, + }, + pageShow: { + EventType: 'PageTransitionEvent', + defaultInit: {bubbles: true, cancelable: true}, + }, } export const eventAliasMap = { diff --git a/types/events.d.ts b/types/events.d.ts index 57a7edd6..b524c189 100644 --- a/types/events.d.ts +++ b/types/events.d.ts @@ -88,6 +88,8 @@ export type EventType = | 'lostPointerCapture' | 'offline' | 'online' + | 'pageHide' + | 'pageShow' export type FireFunction = ( element: Document | Element | Window | Node,