From 644d081af58a19aabcff04fcdc98c22e2cf2afb6 Mon Sep 17 00:00:00 2001 From: Rob <12097319+Rob3rtH@users.noreply.github.com> Date: Thu, 25 Jan 2018 21:54:16 +0000 Subject: [PATCH] Update gatsby-browser.js (#3694) --- examples/using-page-transitions/gatsby-browser.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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 +}