diff --git a/examples/using-page-transitions/gatsby-browser.js b/examples/using-page-transitions/gatsby-browser.js index 9f52cd326fb26..2ccfefcdc5313 100644 --- a/examples/using-page-transitions/gatsby-browser.js +++ b/examples/using-page-transitions/gatsby-browser.js @@ -10,7 +10,8 @@ const timeout = 250 const historyExitingEventType = `history::exiting` const getUserConfirmation = (pathname, callback) => { - const event = new CustomEvent(historyExitingEventType, { detail: { pathname } }) + const event = document.createEvent("CustomEvent"); + event.initCustomEvent(historyExitingEventType, false, false, { detail: { pathname } }); window.dispatchEvent(event) setTimeout(() => { callback(true) @@ -85,4 +86,4 @@ exports.replaceComponentRenderer = ({ props, loader }) => { return undefined } return createElement(ReplaceComponentRenderer, { ...props, loader }) -} \ No newline at end of file +}