Skip to content

Commit

Permalink
Update gatsby-browser.js
Browse files Browse the repository at this point in the history
  • Loading branch information
Rob3rtH committed Jan 25, 2018
1 parent 6c440f6 commit 77456e5
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 77456e5

Please sign in to comment.