First refactor without AI
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
import { GlobalSettings, WidgetData } from '../types';
|
||||
import { DEFAULT_SETTINGS } from '../defaults';
|
||||
|
||||
export const settingsService = {
|
||||
saveSetting: async <K extends keyof GlobalSettings>(key: K, value: GlobalSettings[K]) => {
|
||||
return await chrome.storage.sync.set({
|
||||
[key]: value
|
||||
})
|
||||
},
|
||||
|
||||
getSetting: async <K extends keyof GlobalSettings>(key: K): Promise<GlobalSettings[K]> => {
|
||||
const loaded = await chrome.storage.sync.get([key])
|
||||
return loaded[key] as GlobalSettings[K]
|
||||
},
|
||||
|
||||
};
|
||||
Reference in New Issue
Block a user