MCPcopy Create free account
hub / github.com/SpacehuhnTech/espwebtool / loadSettings

Function loadSettings

src/lib/settings.js:16–31  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

14}
15
16const loadSettings = () => {
17 let settings = {...defaultSettings}
18
19 const cookieValue = getCookie('settings')
20
21 try {
22 const cookieJSON = JSON.parse(cookieValue)
23
24 if ('baudRate' in cookieJSON) settings.baudRate = cookieJSON.baudRate
25 } catch (e) {
26 saveSettings(settings)
27 console.error(e)
28 }
29
30 return settings
31}
32
33const saveSettings = (newSettings) => {
34 setCookie('settings', JSON.stringify(newSettings), 365)

Callers 1

App.jsFile · 0.90

Calls 2

getCookieFunction · 0.90
saveSettingsFunction · 0.85

Tested by

no test coverage detected