budibase/packages/builder/src/builderStore/index.js

24 lines
465 B
JavaScript
Raw Normal View History

import getStore from "./store"
2019-07-13 11:35:57 +02:00
export const store = getStore()
2019-07-13 11:35:57 +02:00
export const initialise = async () => {
try {
setupRouter(store)
await store.initialise()
} catch (err) {
console.log(err)
}
}
const setupRouter = writable => {
const pushState = history.pushState
history.pushState = () => {
2020-02-25 16:21:23 +01:00
pushState.apply(history, [writable])
writable.initialise()
}
window.addEventListener("hashchange", () => {
writable.initialise()
})
}