Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const navigate = (to, options = {}) => {
// Temp hack while awaiting https://github.com/reach/router/issues/119
if (!options.replace) {
window.__navigatingToLink = true
}
let { pathname } = parsePath(to)
const redirect = redirectMap[pathname]
// If we're redirecting, just replace the passed in pathname
// to the one we want to redirect to.
if (redirect) {
to = redirect.toPath
pathname = parsePath(to).pathname
}
// If we had a service worker update, no matter the path, reload window and
// reset the pathname whitelist
if (window.___swUpdated) {
window.location = pathname
return
}
// Start a timer to wait for a second before transitioning and showing a
// loader in case resources aren't around yet.
const timeoutId = setTimeout(() => {
emitter.emit(`onDelayedLoadPageResources`, { pathname })
apiRunner(`onRouteUpdateDelayed`, {
location: window.location,
})
const navigate = (to, options = {}) => {
// Temp hack while awaiting https://github.com/reach/router/issues/119
if (!options.replace) {
window.__navigatingToLink = true
}
let { pathname } = parsePath(to)
const redirect = redirectMap[pathname]
// If we're redirecting, just replace the passed in pathname
// to the one we want to redirect to.
if (redirect) {
to = redirect.toPath
pathname = parsePath(to).pathname
}
// If we had a service worker update, no matter the path, reload window and
// reset the pathname whitelist
if (window.___swUpdated) {
window.location = pathname
return
}
// Start a timer to wait for a second before transitioning and showing a
// loader in case resources aren't around yet.
const timeoutId = setTimeout(() => {
emitter.emit(`onDelayedLoadPageResources`, { pathname })
apiRunner(`onRouteUpdateDelayed`, {
location: window.location,
})
const navigate = (to, options = {}) => {
// Temp hack while awaiting https://github.com/reach/router/issues/119
if (!options.replace) {
window.__navigatingToLink = true
}
let { pathname } = parsePath(to)
const redirect = redirectMap[pathname]
// If we're redirecting, just replace the passed in pathname
// to the one we want to redirect to.
if (redirect) {
to = redirect.toPath
pathname = parsePath(to).pathname
}
// If we had a service worker update, no matter the path, reload window and
// reset the pathname whitelist
if (window.___swUpdated) {
window.location = pathname
return
}
const navigate = (to, options = {}) => {
// Temp hack while awaiting https://github.com/reach/router/issues/119
if (!options.replace) {
window.__navigatingToLink = true
}
let { pathname } = parsePath(to)
const redirect = redirectMap[pathname]
// If we're redirecting, just replace the passed in pathname
// to the one we want to redirect to.
if (redirect) {
to = redirect.toPath
pathname = parsePath(to).pathname
}
// If we had a service worker update, no matter the path, reload window and
// reset the pathname whitelist
if (window.___swUpdated) {
window.location = pathname
return
}