Posthog load settings on startup (#734)
Signed-off-by: Timo K <timok@element.io> Co-authored-by: Šimon Brandner <simon.bra.ag@gmail.com>
This commit is contained in:
parent
85959046a5
commit
01244c1873
2 changed files with 13 additions and 4 deletions
|
|
@ -51,6 +51,12 @@ const useSetting = <T>(
|
|||
),
|
||||
];
|
||||
};
|
||||
export const getSetting = <T>(name: string, defaultValue: T): T => {
|
||||
const key = `matrix-setting-${name}`;
|
||||
|
||||
const item = localStorage.getItem(key);
|
||||
return item === null ? defaultValue : JSON.parse(item);
|
||||
};
|
||||
|
||||
export const useSpatialAudio = () => useSetting("spatial-audio", false);
|
||||
export const useShowInspector = () => useSetting("show-inspector", false);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue