Skip to content

Commit

Permalink
Update gatsby-browser.js (gatsbyjs#3694)
Browse files Browse the repository at this point in the history
  • Loading branch information
Rob3rtH authored and KyleAMathews committed Jan 25, 2018
1 parent c0199cf commit 644d081
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions examples/using-page-transitions/gatsby-browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -85,4 +86,4 @@ exports.replaceComponentRenderer = ({ props, loader }) => {
return undefined
}
return createElement(ReplaceComponentRenderer, { ...props, loader })
}
}

0 comments on commit 644d081

Please sign in to comment.