Hook up more of the API
This commit is contained in:
@@ -10,11 +10,17 @@ export type UIState = {
|
||||
uiUnlocked: boolean,
|
||||
uiEditMode: UIEditMode,
|
||||
|
||||
reconnecting: boolean,
|
||||
isSavingToLocalStorage: boolean
|
||||
}
|
||||
|
||||
export type WritableUIStateStore = Writable<UIState>;
|
||||
const store: WritableUIStateStore = writable(
|
||||
type UIStateOps = {
|
||||
reconnecting: () => void,
|
||||
reconnected: () => void,
|
||||
}
|
||||
|
||||
export type WritableUIStateStore = Writable<UIState> & UIStateOps;
|
||||
const store: Writable<UIState> = writable(
|
||||
{
|
||||
graphLocked: false,
|
||||
nodesLocked: false,
|
||||
@@ -22,11 +28,22 @@ const store: WritableUIStateStore = writable(
|
||||
uiUnlocked: false,
|
||||
uiEditMode: "widgets",
|
||||
|
||||
reconnecting: false,
|
||||
isSavingToLocalStorage: false
|
||||
})
|
||||
|
||||
function reconnecting() {
|
||||
store.update(s => { s.reconnecting = true; return s; })
|
||||
}
|
||||
|
||||
function reconnected() {
|
||||
store.update(s => { s.reconnecting = false; return s; })
|
||||
}
|
||||
|
||||
const uiStateStore: WritableUIStateStore =
|
||||
{
|
||||
...store
|
||||
...store,
|
||||
reconnecting,
|
||||
reconnected
|
||||
}
|
||||
export default uiStateStore;
|
||||
|
||||
Reference in New Issue
Block a user