mirror of
https://github.com/BillyOutlast/posthog.com.git
synced 2026-02-04 03:11:21 +01:00
24 lines
775 B
JavaScript
24 lines
775 B
JavaScript
/**
|
|
* Implement Gatsby's Browser APIs in this file.
|
|
*
|
|
* See: https://www.gatsbyjs.org/docs/browser-apis/
|
|
*/
|
|
|
|
import { initKea, wrapElement } from './kea'
|
|
import './src/styles/global.css'
|
|
|
|
initKea(false)
|
|
|
|
export const wrapRootElement = wrapElement
|
|
export const onRouteUpdate = ({ location, prevLocation }) => {
|
|
// This is checked and set on initial load in the body script set in gatsby-ssr.js
|
|
// Checking for prevLocation prevents this from happening twice
|
|
if (typeof window !== 'undefined' && prevLocation) {
|
|
var slug = location.pathname.substring(1)
|
|
var theme = /^handbook|^docs|^blog|^integrations|^product|^tutorials|^questions/.test(slug)
|
|
? window.__theme
|
|
: 'light'
|
|
document.body.className = theme
|
|
}
|
|
}
|