-
Notifications
You must be signed in to change notification settings - Fork 1
/
gatsby-browser.js
executable file
·39 lines (34 loc) · 1014 Bytes
/
gatsby-browser.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import "./src/styles/constant.scss";
import "./src/styles/font.scss";
import "./src/styles/index.scss";
import "./src/styles/base.scss";
import store, { Actions } from "./src/state";
import "katex/dist/katex.min.css";
import dayjs from "dayjs";
import duration from "dayjs/plugin/duration";
dayjs.extend(duration);
/**
* @param {RouteUpdateArgs} args
*/
export const onRouteUpdate = (args) => {
if (store.getState().isLoading) {
const disableLoadingAction = Actions.createChangeLoadingStateAction({
enable: false,
});
store.dispatch(disableLoadingAction);
}
const action = Actions.createChangePathnameAction({
destination: args.location.pathname,
});
store.dispatch(action);
};
/**
* @param {RouteUpdateDelayedArgs} _args
*/
export const onRouteUpdateDelayed = (/*_args*/) => {
const enableLoadingAction = Actions.createChangeLoadingStateAction({
enable: true,
});
store.dispatch(enableLoadingAction);
};
export { wrapRootElement } from "./src/gatsby-container";