generated from cms/tibi-docs
backend & types
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import App from "./components/App.svelte"
|
||||
import { location } from "./store"
|
||||
import App from "./App.svelte"
|
||||
import { location } from "./lib/store"
|
||||
|
||||
const publishLocation = (_p?: string) => {
|
||||
let _s: string
|
||||
@@ -17,11 +17,8 @@ const publishLocation = (_p?: string) => {
|
||||
}
|
||||
|
||||
const newLocation = {
|
||||
path:
|
||||
_p || (typeof window !== "undefined" && window.location?.pathname),
|
||||
search: _p
|
||||
? _s
|
||||
: typeof window !== "undefined" && window.location?.search,
|
||||
path: _p || (typeof window !== "undefined" && window.location?.pathname),
|
||||
search: _p ? _s : typeof window !== "undefined" && window.location?.search,
|
||||
hash: _p ? _h : typeof window !== "undefined" && window.location?.hash,
|
||||
push: !!_p,
|
||||
pop: !_p,
|
||||
@@ -35,9 +32,7 @@ if (typeof history !== "undefined") {
|
||||
if (typeof Proxy !== "undefined") {
|
||||
// modern browser
|
||||
const historyApply = (target, thisArg, argumentsList) => {
|
||||
publishLocation(
|
||||
argumentsList && argumentsList.length >= 2 && argumentsList[2]
|
||||
)
|
||||
publishLocation(argumentsList && argumentsList.length >= 2 && argumentsList[2])
|
||||
Reflect.apply(target, thisArg, argumentsList)
|
||||
}
|
||||
|
||||
@@ -57,11 +52,7 @@ if (typeof history !== "undefined") {
|
||||
publishLocation(url)
|
||||
return pushStateFn.apply(history, arguments)
|
||||
}
|
||||
history.replaceState = function (
|
||||
data: any,
|
||||
title: string,
|
||||
url?: string
|
||||
) {
|
||||
history.replaceState = function (data: any, title: string, url?: string) {
|
||||
publishLocation(url)
|
||||
return replaceStateFn.apply(history, arguments)
|
||||
}
|
||||
@@ -83,4 +74,4 @@ const app = new App({
|
||||
hydrate,
|
||||
})
|
||||
|
||||
export default app
|
||||
export default app
|
||||
|
||||
Reference in New Issue
Block a user