Skip to content

Instantly share code, notes, and snippets.

@rony-arnac
Last active January 18, 2023 09:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rony-arnac/71c7cdd6cd94c504292b223ae92800ba to your computer and use it in GitHub Desktop.
Save rony-arnac/71c7cdd6cd94c504292b223ae92800ba to your computer and use it in GitHub Desktop.
simple storage management that doesn't handle concurrent access
const key = 'FORDEFI_data';
async function storeComplexData (complexData: Record<string, string[]>) {
await chrome.storage.local.set({[key]: complexData});
}
async function getComplexData () {
return (await chrome.storage.local.get([key]))?.[key];
}
async function getComplexDataItem (complexDataKey: string) {
const complexData = await getComplexData();
return complexData[complexDataKey];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment