Files
30-seconds-of-code/node_modules/gatsby-plugin-transition-link/gatsby-browser.js
2019-08-20 15:52:05 +02:00

20 lines
543 B
JavaScript

"use strict";
var _require = require("gatsby"),
navigate = _require.navigate;
exports.wrapPageElement = require("./wrap-page");
exports.shouldUpdateScroll = function () {
return !window.__tl_inTransition;
};
exports.onPreRouteUpdate = function (_ref) {
var location = _ref.location;
// prevent the back button during transitions as it breaks pages
if (window.__tl_inTransition && location.pathname !== window.__tl_desiredPathname) {
window.__tl_back_button_pressed = true;
navigate(window.__tl_desiredPathname);
}
};