import { get, put } from './lib'; interface State { lon: number; lat: number; rotation: number; zoom: number; provider: string; } export const getState = async () => { try { const state = (await get('state')).doc; console.log({ caller: 'getState', state }); return state; } catch { return null; } }; export const setState = async (state: State) => { await put('state', 'state', (doc) => state, {}); console.log({ caller: 'setState', state }); return 'state'; };